Skip to content

Commit

Permalink
add member annunciates
Browse files Browse the repository at this point in the history
  • Loading branch information
qinmingyuan committed Dec 4, 2023
1 parent 6593943 commit 63a6320
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ GIT

GIT
remote: https://github.com/work-design/rails_com.git
revision: 63a44eabf15977510ef1432bf0bec9af635fc81c
revision: b719f7e862907c1717ab3643fe20706f86cd652d
specs:
rails_com (1.3.0)
acme-client
Expand Down
3 changes: 3 additions & 0 deletions app/controllers/notice/admin/member_annunciates_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class Notice::Admin::MemberAnnunciatesController < Notice::Admin::BaseController

end
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<td><%= model.state %></td>
<td><%= model.annunciated_at %></td>
<td><%= model.notifications_count %></td>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<th><%= MemberAnnunciate.human_attribute_name(:state) %></th>
<th><%= MemberAnnunciate.human_attribute_name(:annunciated_at) %></th>
<th><%= MemberAnnunciate.human_attribute_name(:notifications_count) %></th>
3 changes: 3 additions & 0 deletions app/views/notice/admin/member_annunciates/_form.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<%= f.text_field :state %>
<%= f.text_field :annunciated_at %>
<%= f.text_field :notifications_count %>
12 changes: 12 additions & 0 deletions app/views/notice/admin/member_annunciates/_show_table.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<tr>
<td class="has-text-right"><%= MemberAnnunciate.human_attribute_name(:state) %></td>
<td><%= @member_annunciate.state %></td>
</tr>
<tr>
<td class="has-text-right"><%= MemberAnnunciate.human_attribute_name(:annunciated_at) %></td>
<td><%= @member_annunciate.annunciated_at %></td>
</tr>
<tr>
<td class="has-text-right"><%= MemberAnnunciate.human_attribute_name(:notifications_count) %></td>
<td><%= @member_annunciate.notifications_count %></td>
</tr>
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
require 'test_helper'
class Notice::Admin::MemberAnnunciatesControllerTest < ActionDispatch::IntegrationTest

setup do
@member_annunciate = member_annunciates(:one)
end

test 'index ok' do
get url_for(controller: 'notice/admin/member_annunciates')

assert_response :success
end

test 'new ok' do
get url_for(controller: 'notice/admin/member_annunciates')

assert_response :success
end

test 'create ok' do
assert_difference('MemberAnnunciate.count') do
post(
url_for(controller: 'notice/admin/member_annunciates', action: 'create'),
params: { member_annunciate: { annunciated_at: @notice_admin_member_annunciate.annunciated_at, notifications_count: @notice_admin_member_annunciate.notifications_count, state: @notice_admin_member_annunciate.state } },
as: :turbo_stream
)
end

assert_response :success
end

test 'show ok' do
get url_for(controller: 'notice/admin/member_annunciates', action: 'show', id: @member_annunciate.id)

assert_response :success
end

test 'edit ok' do
get url_for(controller: 'notice/admin/member_annunciates', action: 'edit', id: @member_annunciate.id)

assert_response :success
end

test 'update ok' do
patch(
url_for(controller: 'notice/admin/member_annunciates', action: 'update', id: @member_annunciate.id),
params: { member_annunciate: { annunciated_at: @notice_admin_member_annunciate.annunciated_at, notifications_count: @notice_admin_member_annunciate.notifications_count, state: @notice_admin_member_annunciate.state } },
as: :turbo_stream
)

assert_response :success
end

test 'destroy ok' do
assert_difference('MemberAnnunciate.count', -1) do
delete url_for(controller: 'notice/admin/member_annunciates', action: 'destroy', id: @member_annunciate.id), as: :turbo_stream
end

assert_response :success
end

end

0 comments on commit 63a6320

Please sign in to comment.