Description:
add best_in_place tidy up route
Commit status:
[Not Reviewed]
References:
Comments:
0 Commit comments 0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
Add another comment

r474:24d67ab56dc2 - - 7 files changed: 32 inserted, 4 deleted

@@ -37,6 +37,9
37 37 # gem 'debugger'
38 38 #
39 39
40 + #in-place editor
41 + gem 'best_in_place', '~> 3.0.1'
42 +
40 43 # jquery addition
41 44 gem 'jquery-rails'
42 45 gem 'jquery-ui-sass-rails'
@@ -37,6 +37,9
37 37 i18n (~> 0.6, >= 0.6.4)
38 38 multi_json (~> 1.0)
39 39 arel (3.0.3)
40 + best_in_place (3.0.2)
41 + actionpack (>= 3.2)
42 + railties (>= 3.2)
40 43 builder (3.0.4)
41 44 coffee-rails (3.2.2)
42 45 coffee-script (>= 2.2.0)
@@ -149,6 +152,7
149 152 ruby
150 153
151 154 DEPENDENCIES
155 + best_in_place (~> 3.0.1)
152 156 coffee-rails (~> 3.2.1)
153 157 dynamic_form
154 158 haml
@@ -5,3 +5,10
5 5 //= require jquery.ui.slider
6 6 //= require jquery-ui-timepicker-addon
7 7 //= require jquery-tablesorter
8 + //= require best_in_place
9 + //= require best_in_place.jquery-ui
10 +
11 + $(document).ready(function() {
12 + /* Activating Best In Place */
13 + jQuery(".best_in_place").best_in_place();
14 + });
@@ -3,9 +3,6
3 3 before_filter :authenticate
4 4 before_filter { |controller| controller.authorization_by_roles(['admin'])}
5 5
6 - in_place_edit_for :grader_configuration, :key
7 - in_place_edit_for :grader_configuration, :type
8 - in_place_edit_for :grader_configuration, :value
9 6
10 7 def index
11 8 @configurations = GraderConfiguration.find(:all,
@@ -17,4 +14,15
17 14 redirect_to :action => 'index'
18 15 end
19 16
17 + def update
18 + @config = GraderConfiguration.find(params[:id])
19 + respond_to do |format|
20 + if @config.update_attributes(params[:grader_configuration])
21 + format.json { head :ok }
22 + else
23 + format.json { respond_with_bip(@config) }
24 + end
25 + end
26 + end
27 +
20 28 end
@@ -1,3 +1,6
1 + - content_for :header do
2 + = javascript_include_tag 'local_jquery'
3 +
1 4 %h1 System configuration
2 5
3 6 %table.info
@@ -14,7 +17,7
14 17 %td
15 18 = in_place_editor_field :grader_configuration, :value_type, {}, :rows=>1
16 19 %td
17 - = in_place_editor_field :grader_configuration, :value, {}, :rows=>1
20 + = best_in_place @grader_configuration, :value, ok_button: "ok", cancel_button: "cancel"
18 21 %td= conf.description
19 22
20 23 - if GraderConfiguration.config_cached?
@@ -1,5 +1,6
1 1 - content_for :head do
2 2 = stylesheet_link_tag 'graders'
3 + = javascript_include_tag 'local_jquery'
3 4 <meta http-equiv ="refresh" content="60"/>
4 5
5 6 %h1 Grader information
@@ -6,6 +6,8
6 6 resources :announcements
7 7 resources :sites
8 8
9 + resources :grader_configuration, controller: 'configurations'
10 +
9 11 # The priority is based upon order of creation:
10 12 # first created -> highest priority.
11 13
You need to be logged in to leave comments. Login now