Permalink
Browse files

Refactored views for other_works. Closes #76

  • Loading branch information...
ifunam-mirror committed Nov 29, 2011
1 parent 4578ae0 commit aaf7d810fec2933c322ef9a6cbd6929b485c98c3
@@ -1,20 +1,16 @@
-%tr{:class => cycle('record-odd', 'record-even'), :id => dom_id(record) }
- %td{:style => 'width: 30px;'}
- = checkbox_to_delete(record)
- %td{:style => 'width: 630px;'}
- = record.as_text
- = image_tag('associated_record.png', :border => 0, :style => 'float: right;', :title => t(:associated) )
- %td{:class => 'action'}
- %div{:class => 'ui-widget ui-widget-content ui-corner-all associated_authors', :style => 'width: 32px; height:18px; padding: 2px;', :id => 'associated_authors_' + dom_id(record) }
- %span{:style => 'float: left; text-align: right; color:white; margin-left: 5px;', :id => 'associated_authors_size_'+ dom_id(record) }
- = record.users.size
- %div{:class => "ui-state-default ui-corner-all", :style => 'heigth: 16px;'}
- = link_to_user_list record, user_list_other_work_path(:id => record.id, :format => 'js')
- %td{:style => 'width: 60px; text-align: center;', :class => 'add_or_delete_author'}
- = link_to_action 'ui-icon-minus', t(:del_author), del_user_other_work_path(:id => record.id, :format => :js), 'data-parent-id' => dom_id(record)
- %td{:style => 'width: 60px; text-align: center;'}
- = link_to_action 'ui-icon-zoomin', t(:show), other_work_path(:id => record.id)
- %td{:style => 'width: 60px; text-align: center;'}
- = link_to_action 'ui-icon-pencil', t(:edit), edit_other_work_path(:id => record.id)
- %td{:style => 'width: 60px; text-align: center;'}
- = link_to_delete record, other_work_path(:id => record.id)
+.span-1= checkbox_to_delete(record)
+.span-8
+ = record.as_text
+ = image_tag('associated_record.png', :class => 'associated_record_indicator', :title => t(:associated))
+.associated_authors
+ .authors_size= record.users.size
+ = link_to_user_list user_list_other_work_path(:id => record.id, :format => 'js')
+.author_action
+ = link_to_del_author t(:del_author), del_user_other_work_path(:id => record.id, :format => :js)
+.action
+ = link_to_show other_work_path(:id => record.id)
+.action
+ =link_to_edit edit_other_work_path(:id => record.id)
+.action
+ = link_to_delete record, other_work_path(:id => record.id)
+
@@ -1,8 +1,3 @@
-%tr
- %td{:style => 'text-align: center;'}
- %td{:style => 'text-align: center;'}
- = link_as_button t(:delete_all_selected), '#', :class_button => 'dangerous_button', :id => 'destroy_selected_records', :confirm => t(:delete_all_confirm_question)
- - 4.times do
- %td{:style => 'text-align: center;'}
- %td{:style => 'text-align: center; width: 120px;'}
- = link_as_button t(:show_all), '#', :remote => true, :id => 'filter_reset_all', :class_button => 'green_button'
+#collection_footer
+ #footer_buttons
+ = link_to t(:delete_all_selected), '#', :id => 'destroy_selected_records', :confirm => t(:delete_all_confirm_question)
@@ -0,0 +1,8 @@
+#collection_header
+ .span-1="Id"
+ .span-8=t('.title')
+ .span-1='*'
+ .span-1='+/-'
+ .action=t(:show)
+ .action=t(:edit)
+ .action.last=t(:del)
@@ -1,26 +0,0 @@
-%tr{:class => "filter_header", :id => "filter_header"}
- = form_for :search, :remote => true, :html => {:id => "filter_form"} do |f|
- %th{:class => 'ui-state-default', :style => 'width: 5%;'}
- =t(:id)
- %th{:class => 'ui-state-default', :style => 'width: 55%;'}
- %div{:class => 'span-2'}=t(:authors)
- %div{:class => 'span-2'}=t(:title)
- %div{:class => 'span-4'}=t(:genericworktype)
- %div{:class => 'span-4'}=t(:genericworkstatus)
- %div{:class => 'span-1 last'}=t(:year)
-
- %div{:class => 'span-2'}= f.text_field :authors_like_ignore_case, :size => 7
- %div{:class => 'span-2'}= f.text_field :title_like_ignore_case, :size => 7
- %div{:class => 'span-4'}= f.collection_select :genericworktype_id_eq, Genericworktype.other_works, :id, :name, :prompt => true
- %div{:class => 'span-4'}= f.collection_select :genericworkstatus_id_eq, Genericworkstatus.all, :id, :name, :prompt => true
- %div{:class => 'span-1 last'}= f.text_field :year_eq, :size => 4
- %th{:class => 'ui-state-default', :style => 'width: 10%;'}
- ='Académicos del instituto asociados al trabajo'
- %th{:class => 'ui-state-default', :style => 'width: 90px;'}
- ='Quitar asociación al trabajo'
- %th{:class => 'ui-state-default', :style => 'width: 60px;'}
- =t(:show)
- %th{:class => 'ui-state-default', :style => 'width: 60px;'}
- =t(:edit)
- %th{:class => 'ui-state-default', :style => 'width: 60px;'}
- =t(:del)
@@ -1,21 +1,24 @@
-= render :partial => "/shared/errors", :object => f.object.errors
+.section-with-border-and-bg
+ .row
+ = render :partial => "/shared/errors", :object => f.object.errors
-%div{ :class => 'span-24 section_left append-bottom last' }
- = f.input :authors, :as => :text, :input_html => { :size => '60x1' }, :wrapper_class => 'span-12'
- = f.input :title, :as => :text, :input_html => { :size => '60x1' }, :wrapper_class => 'span-12 last'
+ .row
+ .span-9= f.input :authors, :as => :text, :input_html => { :size => '60x2' }
+ .span-9.last= f.input :title, :as => :text, :input_html => { :size => '60x2' }
- %div{:class => 'span-6'}
- = f.label :role, :required => true
- = render :partial => 'user_genericworks/form', :locals => {:genericwork => @genericwork, :f => f}
+ .row
+ .span-3
+ = f.input :year, :as => :string, :input_html => { :size => '4', :autocomplete => "off", :value => Date.today.year }
+ .span-6
+ = f.label :month, :required => true
+ = select_month_for 'month', 'genericwork'
+ .span-9.last
+ = f.hidden_field :genericworktype_id, :value => 16
+ = f.hidden_field :genericworkstatus_id, :value => 3
- = f.input :year, :as => :string, :input_html => { :size => '4', :autocomplete => "off", :value => Date.today.year }, :wrapper_class => 'span-6', :required => true
- %div{:class => 'span-6 last'}
- = f.label :month, :required => true
- = select_month(Date.today, :field_name => 'month', :prefix => 'genericwork')
- = f.hidden_field :genericworktype_id, :value => 16
- = f.hidden_field :genericworkstatus_id, :value => 3
-
- %div{:class => 'span-24 ui-widget last', :id => 'institution', 'data-controller-name'=>'institutions' }
- = f.label :institution, :required => true
- = f.select :institution_id, [], {:prompt => true}, {:class => 'autocompleted_select'}
- = link_to_action 'ui-icon-plus', 'Agregar institución', '#', :id => 'new_record'
+ .row
+ #institution.span-6
+ = f.association :institution, :using => :name, :input_html => {:prompt => true, :class => 'chosen-select', :required => true}
+ = link_to_new_record 'Agregar institución', new_institution_path
+ .span-12.last
+ = render :partial => 'user_genericworks/form', :locals => {:genericwork => @genericwork, :f => f}
@@ -1,26 +1,16 @@
-%tr{:class => cycle('record-odd', 'record-even'), :id => dom_id(record) }
- %td{:style => 'width: 30px;'}
- = checkbox_to_delete(record)
- %td{:style => 'width: 630px;'}
- = record.as_text
- %div{:class => 'ui-state-highlight ui-corner-all', :id => 'associated_records'}
- %span{:class => 'ui-icon ui-icon-info', :style => 'float: right;', :title => t(:not_associated)}
- %td{:class => 'action'}
- %div{:class => 'ui-widget ui-widget-content ui-corner-all associated_authors', :style => 'width: 32px; height:18px; padding: 2px;', :id => 'associated_authors_' + dom_id(record) }
- %span{:style => 'float: left; text-align: right; color:white; margin-left: 5px;', :id => 'associated_authors_size_'+ dom_id(record) }
- = record.users.size
- %div{:class => "ui-state-default ui-corner-all", :style => 'heigth: 16px;'}
- = link_to_user_list record, user_list_other_work_path(:id => record.id, :format => 'js')
- %td{:class => 'action'}
- %div{:class => 'ui-widget ui-widget-content ui-corner-all associated_authors', :style => 'width: 80px; height:18px; padding: 2px; font-size:10px;', :id => 'associated_users_' + dom_id(record) }
- %span{:style => 'float: left; text-align: right; color:white; margin-left: 5px;', :id => 'associated_users_size_'+ dom_id(record) }
- = t('select')
- %div{:class => "ui-state-default ui-corner-all", :style => 'heigth: 16px;'}
- = link_to_user_list record, role_list_other_work_path(:id => record.id, :format => 'js')
-
- %td{:style => 'width: 60px; text-align: center;'}
- = link_to_action 'ui-icon-zoomin', t(:show), other_work_path(:id => record.id)
- %td{:style => 'width: 60px; text-align: center;'}
- = link_to_action 'ui-icon-pencil', t(:edit), edit_other_work_path(:id => record.id)
- %td{:style => 'width: 60px; text-align: center;'}
- = link_to_delete record, other_work_path(:id => record.id)
+.span-1= checkbox_to_delete(record)
+.span-8
+ = record.as_text
+ .not_associated{:title => t(:not_associated)}
+.associated_authors
+ .authors_size= record.users.size
+ = link_to_user_list user_list_other_work_path(:id => record.id, :format => 'js')
+.role_action
+ = link_to_add_role t(:add_role), role_list_other_work_path(:id => record.id, :format => 'js')
+.action
+ = link_to_show other_work_path(:id => record.id)
+.action
+ = link_to_edit edit_other_work_path(:id => record.id)
+.action
+ = link_to_delete record, other_work_path(:id => record.id)
+
@@ -1,26 +0,0 @@
-%tr{:class => "filter_header", :id => "filter_header"}
- = form_for :search, :remote => true, :html => {:id => "filter_form"} do |f|
- %th{:class => 'ui-state-default', :style => 'width: 5%;'}
- =t(:id)
- %th{:class => 'ui-state-default', :style => 'width: 55%;'}
- %div{:class => 'span-2'}=t(:authors)
- %div{:class => 'span-2'}=t(:title)
- %div{:class => 'span-4'}=t(:genericworktype)
- %div{:class => 'span-4'}=t(:genericworkstatus)
- %div{:class => 'span-1 last'}=t(:year)
-
- %div{:class => 'span-2'}= f.text_field :authors_like_ignore_case, :size => 7
- %div{:class => 'span-2'}= f.text_field :title_like_ignore_case, :size => 7
- %div{:class => 'span-4'}= f.collection_select :genericworktype_id_eq, Genericworktype.all, :id, :name, :prompt => true
- %div{:class => 'span-4'}= f.collection_select :genericworkstatus_id_eq, Genericworkstatus.all, :id, :name, :prompt => true
- %div{:class => 'span-1 last'}= f.text_field :year_eq, :size => 4
- %th{:class => 'ui-state-default', :style => 'width: 10%;'}
- ='Académicos del instituto asociados al trabajo'
- %th{:class => 'ui-state-default', :style => 'width: 90px;'}
- ='Agregar asociación al trabajo'
- %th{:class => 'ui-state-default', :style => 'width: 60px;'}
- =t(:show)
- %th{:class => 'ui-state-default', :style => 'width: 60px;'}
- =t(:edit)
- %th{:class => 'ui-state-default', :style => 'width: 60px;'}
- =t(:del)
@@ -1,4 +1,5 @@
-- if record.has_user_id?(current_user.id)
- = render :partial => 'associated', :locals => { :record => record }
-- else
- = render :partial => 'not_associated', :locals => { :record => record }
+.row{:id => dom_id(record), :class => cycle('record-odd', 'record-even')}
+ - if record.has_user_id?(current_user.id)
+ = render :partial => 'associated', :locals => { :record => record }
+ - else
+ = render :partial => 'not_associated', :locals => { :record => record }
@@ -0,0 +1,16 @@
+= form_for :search, :remote => true, :html => {:id => "filter_form"} do |f|
+ .span-3=t(:authors)
+ .span-3=t(:title)
+ .span-5=t(:genericworktype)
+ .span-5=t(:genericworkstatus)
+ .span-2.last=t(:year)
+
+ .span-3= f.text_field :authors_like_ignore_case, :size => 12
+ .span-3= f.text_field :title_like_ignore_case, :size => 12
+ .span-5= f.collection_select :genericworktype_id_eq, Genericworktype.other_works, :id, :name, {:prompt => true}, :class => 'chosen-select'
+ .span-5= f.collection_select :genericworkstatus_id_eq, Genericworkstatus.all, :id, :name, {:prompt => true}, :class => 'chosen-select'
+ .span-2.last= f.text_field :year_eq, :size => 4
+
+ .span-5.prepend-13.last
+ .search_button= link_to t(:search), "#", :id => "search_button"
+ .reset_search_button.last= link_to "Listar todos", "#" , :id => 'reset_search_button'
@@ -1 +1 @@
-= render :partial => 'associated', :locals => { :record => @genericwork }
+= render :partial => 'record', :locals => { :record => @genericwork }
@@ -1 +1 @@
-= render :partial => 'not_associated', :locals => { :record => @genericwork }
+= render :partial => 'record', :locals => { :record => @genericwork }
@@ -1,6 +1,6 @@
%h3= t('.title')
-= simple_form_for @genericwork, :genericwork, :url => other_work_path, :html => { :multipart => true, :id => 'record'} do |f|
+= simple_form_for @genericwork, :as => :genericwork, :url => other_work_path do |f|
= render :partial => 'form', :locals => { :f => f }
- %div{ :class => 'span-24 buttons_left last' }
- = f.submit t(:update), :class => "ui-state-default ui-corner-all button"
- = link_as_button t(:cancel), other_works_path
+ #submit_buttons
+ = f.submit t(:update)
+ = link_to t(:cancel), other_works_path
@@ -1,20 +1,20 @@
-%div{:class => 'span-24 last'}
- %div{:class => 'span-10'}
- %h3= t('.title')
- %div{:class=> 'span-14 nav_links last'}
- = link_to t('.my_works'), other_works_path
- = link_to t('.not_my_works'), not_my_other_works_path
-%br
-%table{:id => 'collection_table', :class => 'ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix'}
- %thead{:id => "filter_header"}
- = render :partial => 'filter_header'
- %tbody{:id =>'collection'}
- = render :partial => 'record', :collection => @genericworks
- = render :partial => 'collection_footer'
- %tfoot{:id => 'paginator'}
- %tr
- %th
- = will_paginate @genericworks
+.span-18.last
+ %h3= t('.title')
-%div{ :class => 'span-24 buttons_left last' }
- = link_as_button t(:new), new_other_work_path
+#nav_links
+ = link_to t('.my_works'), other_works_path
+ = link_to t('.not_my_works'), not_my_other_works_path
+
+= render :partial => 'search_form'
+
+= render :partial => 'collection_header'
+
+#collection_records
+ = render :partial => 'record', :collection => @genericworks
+
+= render :partial => 'collection_footer'
+
+= will_paginate(@genericworks)
+
+#submit_buttons
+ = link_to t(:new), new_other_work_path
@@ -1,7 +1,6 @@
-%tbody{:id =>'collection'}
+#collection_records
= render :partial => 'record', :collection => @genericworks
- = render :partial => 'collection_footer'
-%tfoot{:id => 'paginator'}
- %tr
- %th
- = will_paginate @genericworks, :id => 'ajaxed_paginator'
+
+= render :partial => 'collection_footer'
+
+= will_paginate @genericworks, :id => 'ajaxed_paginator'
@@ -1,6 +1,6 @@
%h3= t('.title')
-= simple_form_for @genericwork, :url => other_works_path, :html => { :multipart => true, :id => 'record'} do |f|
+= simple_form_for @genericwork, :url => other_works_path do |f|
= render :partial => 'form', :locals => { :f => f }
- %div{ :class => 'span-24 buttons_left last' }
- = f.submit t(:save), :class => "ui-state-default ui-corner-all button"
- = link_as_button t(:cancel), other_works_path
+ #submit_buttons
+ = f.submit t(:save)
+ = link_to t(:cancel), other_works_path
@@ -1,20 +1,20 @@
-%div{:class => 'span-24 last'}
- %div{:class => 'span-10'}
- %h3= t('.title')
- %div{:class=> 'span-14 nav_links last'}
- = link_to t('.my_works'), other_works_path
- = link_to t('.not_my_works'), not_my_other_works_path
-%br
-%table{:id => 'collection_table', :class => 'ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix'}
- %thead{:id => "filter_header"}
- = render :partial => 'not_mine_header'
- %tbody{:id =>'collection'}
- = render :partial => 'record', :collection => @genericworks
- = render :partial => 'collection_footer'
- %tfoot{:id => 'paginator'}
- %tr
- %th
- = will_paginate @genericworks
+.span-18.last
+ %h3= t('.title')
-%div{ :class => 'span-24 buttons_left last' }
- = link_as_button t(:new), new_other_work_path
+#nav_links
+ = link_to t('.my_works'), other_works_path
+ = link_to t('.not_my_works'), not_my_other_works_path
+
+= render :partial => 'search_form'
+
+= render :partial => 'collection_header'
+
+#collection_records
+ = render :partial => 'record', :collection => @genericworks
+
+= render :partial => 'collection_footer'
+
+= will_paginate(@genericworks)
+
+#submit_buttons
+ = link_to t(:new), new_other_work_path
@@ -1,7 +1,6 @@
-%tbody{:id =>'collection'}
+#collection_records
= render :partial => 'record', :collection => @genericworks
- = render :partial => 'collection_footer'
-%tfoot{:id => 'paginator'}
- %tr
- %th
- = will_paginate @genericworks, :id => 'ajaxed_paginator'
+
+= render :partial => 'collection_footer'
+
+= will_paginate @genericworks, :id => 'ajaxed_paginator'
@@ -1,10 +1,10 @@
-%div{:class => 'ui-widget ui-widget-content ui-corner-all author_list', :id => 'show_user_roles_'+ dom_id(@genericwork)}
- %div
- %b='Roles'
- %div{:class => "ui-state-default ui-corner-all", :style => 'width: 16px; margin-left: 11px; float:right;'}
- = link_to_function content_tag(:span, '', {:class =>'ui-icon ui-icon-close'}), "$('#show_user_roles_#{dom_id(@genericwork)}').remove();"
- %br
- %ul{:style => 'width: 240px;',:class => 'add_or_delete_author'}
- - @userroles.each do |record|
- %li{:style => 'margin-left: -30px; color: green;'}
- = link_to record.name, add_user_other_work_path(:id => @genericwork.id, :userrole_id => record.id, :format => :js), 'data-parent-id' => dom_id(@genericwork)
+.role_list
+
+ .span-6.last
+ %b=t(:role_selection)
+ = link_to_close_author_list
+
+ .span-6.last
+ %ul
+ - @userroles.each do |record|
+ %li=link_to record.name, '#', 'data-remote-resource' => add_user_other_work_path(:id => @genericwork.id, :userrole_id => record.id, :format => :js)
Oops, something went wrong.

0 comments on commit aaf7d81

Please sign in to comment.