diff --git a/app/controllers/admin/image_files_controller.rb b/app/controllers/admin/image_files_controller.rb index 64ae493..7f0167a 100644 --- a/app/controllers/admin/image_files_controller.rb +++ b/app/controllers/admin/image_files_controller.rb @@ -20,6 +20,7 @@ end def edit + @image_file = ImageFile.find(params[:id]) end def create @@ -37,7 +38,7 @@ def update @image_file = ImageFile.find(params[:id]) - if @image_file.update_attributes(params[:image_file]) + if @image_file.update_attributes(params.require(:image_file).permit!) else diff --git a/app/views/admin/image_files/_form.html.haml b/app/views/admin/image_files/_form.html.haml index a6c21a9..ca81a06 100644 --- a/app/views/admin/image_files/_form.html.haml +++ b/app/views/admin/image_files/_form.html.haml @@ -1,17 +1,14 @@ -= form_for @image_file, :url => admin_image_file_path(:id => @image_file.id, :album_id => params[:album_id], :manager => params[:manager], :multiple => params[:multiple]), :remote => true do |form| - %table{:style => "width:100%"} - %tr - %td{:style => "width:120px"} Nom : - %td= form.text_field :name, :style => "width:90%" - %tr - %td{:style => "width:120px"} Photographe : - %td= form.text_field :photograph, :style => "width:90%" += semantic_form_for @image_file, :url => admin_image_file_path(:id => @image_file.id, :album_id => params[:album_id], :manager => params[:manager], :multiple => params[:multiple]), :remote => true do |form| + + .content + =form.inputs do + = form.input :name, :label => "Nom :" + = form.input :photograph, :label => "Crédits :" + = form.input :description, :label => "Description :" - %tr - %td{:style => "vertical-align:top;"} Description : - %td= form.text_area :description, :style => "max-width:90%;width:90%;height:100px;" + .actions.submit_tr - =link_to "Annuler", admin_image_file_path(:id => @image_file.id, :manager => params[:manager], :multiple => params[:multiple]), :remote => true, :class => "button" - =form.submit "Sauvegarder" + =#link_to "Annuler", admin_image_file_path(:id => @image_file.id, :manager => params[:manager], :multiple => params[:multiple]), :remote => true, :class => "button" + =form.submit "Sauvegarder", :class => "btn btn-primary" \ No newline at end of file diff --git a/app/views/admin/image_files/_image_file.html.haml b/app/views/admin/image_files/_image_file.html.haml index 074dbf2..750c331 100644 --- a/app/views/admin/image_files/_image_file.html.haml +++ b/app/views/admin/image_files/_image_file.html.haml @@ -6,5 +6,5 @@ .name =image_file.name ? truncate(image_file.name, :length => 17) : raw(" ") = link_to i(:"check"), "#",:onclick => "manager_send_image_file("+image_file.id.to_s+");return false;" if params[:manager] and !params[:multiple] - + =link_to i(:pencil), edit_admin_image_file_path(image_file), :remote => true \ No newline at end of file diff --git a/app/views/admin/image_files/edit.js.erb b/app/views/admin/image_files/edit.js.erb new file mode 100644 index 0000000..61c7a6f --- /dev/null +++ b/app/views/admin/image_files/edit.js.erb @@ -0,0 +1 @@ +show_pane_hover("<%= escape_javascript(render(:partial => "form"))%>",850,600); \ No newline at end of file diff --git a/app/views/admin/image_files/update.js.erb b/app/views/admin/image_files/update.js.erb index fdaae54..16f168e 100644 --- a/app/views/admin/image_files/update.js.erb +++ b/app/views/admin/image_files/update.js.erb @@ -1,5 +1,9 @@ $('#image_file_<%= @image_file.id %>').replaceWith("<%= escape_javascript(render(@image_file))%>"); -$('#image_files_big_container #main_workspace_view #image_file_container .form').html("<%= escape_javascript(render(:partial => 'form'))%>"); -set_image_files_img_size($("#image_files_big_container #right_bar #grid_slider").slider("value")); -image_files_load(); \ No newline at end of file + + +//$('#image_files_big_container #main_workspace_view #image_file_container .form').html("<%= escape_javascript(render(:partial => 'form'))%>"); +//set_image_files_img_size($("#image_files_big_container #right_bar #grid_slider").slider("value")); +//image_files_load(); + +close_pane_hover(); \ No newline at end of file