File tree Expand file tree Collapse file tree 7 files changed +26
-15
lines changed Expand file tree Collapse file tree 7 files changed +26
-15
lines changed Original file line number Diff line number Diff line change 1- rails_4.0
1+ browsercms
Original file line number Diff line number Diff line change 1919
2020group :development do
2121 gem 'rake'
22- gem 'debugger'
22+ # gem 'debugger'
2323 gem 'quiet_assets'
2424end
2525group :test , :development do
Original file line number Diff line number Diff line change 7878 activesupport (>= 3.0 )
7979 cocaine (0.5.3 )
8080 climate_control (>= 0.0.3 , < 1.0 )
81- columnize (0.3.6 )
8281 compass (0.12.2 )
8382 chunky_png (~> 1.2 )
8483 fssm (>= 0.2.7 )
9796 nokogiri (>= 1.5.0 )
9897 daemons (1.1.9 )
9998 database_cleaner (1.2.0 )
100- debugger (1.6.2 )
101- columnize (>= 0.3.1 )
102- debugger-linecache (~> 1.2.0 )
103- debugger-ruby_core_source (~> 1.2.3 )
104- debugger-linecache (1.2.0 )
105- debugger-ruby_core_source (1.2.3 )
10699 devise (3.2.2 )
107100 bcrypt-ruby (~> 3.0 )
108101 orm_adapter (~> 0.1 )
@@ -259,7 +252,6 @@ DEPENDENCIES
259252 cucumber
260253 cucumber-rails
261254 database_cleaner
262- debugger
263255 factory_girl_rails (= 3.3.0 )
264256 launchy
265257 m (~> 1.2 )
Original file line number Diff line number Diff line change @@ -32,14 +32,31 @@ def submit
3232 end
3333 end
3434
35+ def bulk_update
36+ # Duplicates ContentBlockController#bulk_update
37+ ids = params [ :content_id ] || [ ]
38+ models = ids . collect do |id |
39+ FormEntry . find ( id . to_i )
40+ end
41+
42+ if params [ :commit ] == 'Delete'
43+ deleted = models . select do |m |
44+ m . destroy
45+ end
46+ flash [ :notice ] = "Deleted #{ deleted . size } records."
47+ end
48+
49+ redirect_to entries_path ( params [ :form_id ] )
50+ end
51+
3552 # Same behavior as ContentBlockController#index
3653 def index
37- form = Cms ::Form . where ( id : params [ :id ] ) . first
54+ @ form = Cms ::Form . where ( id : params [ :id ] ) . first
3855 @blocks = Cms ::FormEntry . where ( form_id : params [ :id ] ) . paginate ( { page : params [ :page ] , order : params [ :order ] } )
39- @entry = Cms ::FormEntry . for ( form )
56+ @entry = Cms ::FormEntry . for ( @ form)
4057
4158 # Allows us to use the content_block/index view
42- @content_type = FauxContentType . new ( form )
59+ @content_type = FauxContentType . new ( @ form)
4360 @search_filter = SearchFilter . build ( params [ :search_filter ] , Cms ::FormEntry )
4461 @total_number_of_items = @blocks . size
4562 end
@@ -115,5 +132,6 @@ def columns_for_index
115132 def content_type
116133 @content_type
117134 end
135+
118136 end
119137end
Original file line number Diff line number Diff line change 11<% content_for :bulk_actions do %>
22 <%= render 'buttons' %>
3+ <%= hidden_field_tag :form_id, @form.id %>
34<% end %>
45<%= render file: 'cms/content_block/index' %>
Original file line number Diff line number Diff line change 9494 post :submit
9595 end
9696 end
97-
97+ put "/form_entries" => "form_entries#bulk_update"
9898 # Faux nested resource for forms (not sure if #content_blocks allows for it.)
9999 get 'forms/:id/entries' => 'form_entries#index' , as : 'entries'
100100
Original file line number Diff line number Diff line change 11Feature : Forms
22
33 Editors should be able to create and manage forms to collect information from site visitors. They should be able
4- to build these forms dyamically through the UI.
4+ to build these forms dynamically through the UI.
55
66 Background :
77 Given I am logged in as a Content Editor
You can’t perform that action at this time.
0 commit comments