diff options
| author | Michel Etienne | 2012-03-20 11:59:27 +0100 |
|---|---|---|
| committer | Michel Etienne | 2012-03-20 11:59:27 +0100 |
| commit | 2011ee0247deede4a58dbdcc6f5c50146dedf584 (patch) | |
| tree | 01bf481ed549e7025b5de5416ed64eca513c25bf /app | |
| parent | 153c6f7022a608c6780b265d3b91c95829b192e4 (diff) | |
| download | chouette-core-2011ee0247deede4a58dbdcc6f5c50146dedf584.tar.bz2 | |
set conformance for line network and company screens with fields specifications
Diffstat (limited to 'app')
| -rw-r--r-- | app/assets/stylesheets/companies.css.scss | 152 | ||||
| -rw-r--r-- | app/assets/stylesheets/networks.css.scss | 152 | ||||
| -rw-r--r-- | app/controllers/companies_controller.rb | 5 | ||||
| -rw-r--r-- | app/controllers/networks_controller.rb | 5 | ||||
| -rw-r--r-- | app/views/companies/_company.erb | 5 | ||||
| -rw-r--r-- | app/views/companies/_form.erb | 10 | ||||
| -rw-r--r-- | app/views/companies/index.html.erb | 15 | ||||
| -rw-r--r-- | app/views/companies/show.html.erb | 16 | ||||
| -rw-r--r-- | app/views/networks/_form.erb | 8 | ||||
| -rw-r--r-- | app/views/networks/_network.erb | 5 | ||||
| -rw-r--r-- | app/views/networks/index.html.erb | 15 | ||||
| -rw-r--r-- | app/views/networks/show.html.erb | 4 |
12 files changed, 384 insertions, 8 deletions
diff --git a/app/assets/stylesheets/companies.css.scss b/app/assets/stylesheets/companies.css.scss new file mode 100644 index 000000000..f6b80831b --- /dev/null +++ b/app/assets/stylesheets/companies.css.scss @@ -0,0 +1,152 @@ +// Place all the styles related to the lines controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +@mixin div_for_object { + margin-bottom: 20px; + + .color { + width: 64px; + height: 64px; + float: left; + margin-right: 10px; + } + + img { + float: left; + margin-right: 10px; + } + + img.preview { + width: 90px; + height: 70px; + } + + a { + display:block; + text-decoration: underline; + margin: 5px 0px 0px 0px; + } + + .info { + font-size: 10px; + color: #777; + font-weight: normal; + line-height: 14px; + margin-top: 5px; + + a { + display:inline; + color: #777; + } + + .actions { + margin-top: 14px; + a { + color: #666; + padding-left: 12px; + } + + a.edit { + background: url(image-path('user_interface/ui/edit-small.png')) no-repeat 0% 50%; + } + a.remove { + background: url(image-path('user_interface/ui/remove-small.png')) no-repeat 0% 50%; + } + } + + p { + margin:0; + } + } +} + +@mixin content_to_clear { + content: " "; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +@mixin after_div_for_object { + @include content_to_clear; +} + +#workspace.companies.index +{ + .company:after { + @include after_div_for_object; + } + + .companies { + margin-top: 20px; + } + + .companies:after { + @include content_to_clear; + } + + .company { + @include div_for_object; + + /* to create multi-column index */ + width: 350px; + float: left; + padding-right: 10px; + + } +} + +#workspace.companies.edit, #workspace.companies.new +{ + #line_color{ width: 100px; + color: white; + font-weight: bold;} +} + +#workspace.lines.show +{ + .line_color{ color: white; + font-weight: bold; + padding: 0 5px 0 5px;} +} + + +#workspace .order { + float: right; + padding: 15px 0; + font-size: 0.8em; + + a { text-decoration: underline; } + + a.current { + font-weight: bold; + text-decoration: none; + } +} + +/* FIXME a déplacer dans layout */ + +#sidebar ul { + padding: 0 8px; + + li { + margin: 4px 0; + } +} + +#sidebar ul.selection li { + a { + padding-left: 20px; + } + a.current { + text-decoration: none; + color: black !important; + background: url(image-path('user_interface/ui/accept.png')) no-repeat; + } + a.all { + background-image: none; + } +} + + diff --git a/app/assets/stylesheets/networks.css.scss b/app/assets/stylesheets/networks.css.scss new file mode 100644 index 000000000..3f62b8bb6 --- /dev/null +++ b/app/assets/stylesheets/networks.css.scss @@ -0,0 +1,152 @@ +// Place all the styles related to the lines controller here. +// They will automatically be included in application.css. +// You can use Sass (SCSS) here: http://sass-lang.com/ +@mixin div_for_object { + margin-bottom: 20px; + + .color { + width: 64px; + height: 64px; + float: left; + margin-right: 10px; + } + + img { + float: left; + margin-right: 10px; + } + + img.preview { + width: 90px; + height: 70px; + } + + a { + display:block; + text-decoration: underline; + margin: 5px 0px 0px 0px; + } + + .info { + font-size: 10px; + color: #777; + font-weight: normal; + line-height: 14px; + margin-top: 5px; + + a { + display:inline; + color: #777; + } + + .actions { + margin-top: 14px; + a { + color: #666; + padding-left: 12px; + } + + a.edit { + background: url(image-path('user_interface/ui/edit-small.png')) no-repeat 0% 50%; + } + a.remove { + background: url(image-path('user_interface/ui/remove-small.png')) no-repeat 0% 50%; + } + } + + p { + margin:0; + } + } +} + +@mixin content_to_clear { + content: " "; + display: block; + height: 0; + clear: both; + visibility: hidden; +} + +@mixin after_div_for_object { + @include content_to_clear; +} + +#workspace.networks.index +{ + .network:after { + @include after_div_for_object; + } + + .networks { + margin-top: 20px; + } + + .networks:after { + @include content_to_clear; + } + + .network { + @include div_for_object; + + /* to create multi-column index */ + width: 350px; + float: left; + padding-right: 10px; + + } +} + +#workspace.networks.edit, #workspace.networks.new +{ + #line_color{ width: 100px; + color: white; + font-weight: bold;} +} + +#workspace.lines.show +{ + .line_color{ color: white; + font-weight: bold; + padding: 0 5px 0 5px;} +} + + +#workspace .order { + float: right; + padding: 15px 0; + font-size: 0.8em; + + a { text-decoration: underline; } + + a.current { + font-weight: bold; + text-decoration: none; + } +} + +/* FIXME a déplacer dans layout */ + +#sidebar ul { + padding: 0 8px; + + li { + margin: 4px 0; + } +} + +#sidebar ul.selection li { + a { + padding-left: 20px; + } + a.current { + text-decoration: none; + color: black !important; + background: url(image-path('user_interface/ui/accept.png')) no-repeat; + } + a.all { + background-image: none; + } +} + + diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index 2b13d78cf..20967f733 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -11,6 +11,11 @@ class CompaniesController < ChouetteController # end protected + def collection + @q = referential.companies.search(params[:q]) + @companies ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page], :per_page => 10) + end + def resource_url(company = nil) referential_company_path(referential, company || resource) diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb index b9423c976..e5c3e3ca7 100644 --- a/app/controllers/networks_controller.rb +++ b/app/controllers/networks_controller.rb @@ -6,6 +6,11 @@ class NetworksController < ChouetteController protected + def collection + @q = referential.networks.search(params[:q]) + @networks ||= @q.result(:distinct => true).order(:name).paginate(:page => params[:page], :per_page => 10) + end + def resource_url(network = nil) referential_network_path(referential, network || resource) end diff --git a/app/views/companies/_company.erb b/app/views/companies/_company.erb index 9d4683414..34c65b798 100644 --- a/app/views/companies/_company.erb +++ b/app/views/companies/_company.erb @@ -1,6 +1,11 @@ <%= div_for(company) do %> <%= link_to company.name, [@referential, company] %> <div class="info"> + <%= company.human_attribute_name('code') %> <%= company.code %> + <div class="actions"> + <%= link_to t("actions.edit"), edit_referential_company_path(@referential, company), :class => "edit" %> | + <%= link_to t("actions.destroy"), referential_company_path(@referential, company), :method => :delete, :confirm => t('companies.actions.destroy_confirm'), :class => "remove" %> + </div> </div> <% end %> diff --git a/app/views/companies/_form.erb b/app/views/companies/_form.erb index 5e902bcec..bea95b0b4 100644 --- a/app/views/companies/_form.erb +++ b/app/views/companies/_form.erb @@ -1,7 +1,6 @@ <%= semantic_form_for [@referential, @company] do |form| %> <%= form.inputs do %> <%= form.input :name %> - <%= form.input :registration_number %> <%= form.input :short_name %> <%= form.input :organizational_unit %> <%= form.input :operating_department_name %> @@ -9,6 +8,15 @@ <%= form.input :phone, :as => :phone %> <%= form.input :fax, :as => :phone %> <%= form.input :email, :as => :email %> + <%= form.input :registration_number %> + <% if @company.new_record? %> + <%= form.input :objectid %> + <% else %> + <li> + <label><%= @company.human_attribute_name("objectid") %>: </label> + <%= @company.objectid %> + </li> + <% end %> <% end %> <%= form.buttons do %> diff --git a/app/views/companies/index.html.erb b/app/views/companies/index.html.erb index 09501d5bf..6b047b0ce 100644 --- a/app/views/companies/index.html.erb +++ b/app/views/companies/index.html.erb @@ -1,6 +1,19 @@ <%= title_tag t('companies.index.title') %> -<%= render :partial => "company", :collection => @companies %> +<%= search_form_for @q, :url => referential_companies_path(@referential), :html => {:method => :get} do |f| %> + <%= f.label :name_cont, "#{t('.name')} :" %> + <%= f.text_field :name_cont %> + + <%= f.submit t('actions.search') %> <%= t("or") %> + <%= link_to t("cancel"), referential_companies_path(@referential) %> +<% end %> + +<%#= will_paginate @companies %> +<div class="companies paginated_content"> + <%= render :partial => "company", :collection => @companies %> +</div> +<%= will_paginate @companies %> + <% content_for :sidebar do %> <ul class="actions"> diff --git a/app/views/companies/show.html.erb b/app/views/companies/show.html.erb index 4dd9e0a21..09a54e98b 100644 --- a/app/views/companies/show.html.erb +++ b/app/views/companies/show.html.erb @@ -4,10 +4,6 @@ <div class="summary"> <p> - <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label> - <%= @company.registration_number %> - </p> - <p> <label><%= Chouette::Company.human_attribute_name("name") %>: </label> <%= @company.name %> </p> @@ -24,6 +20,10 @@ <%= @company.operating_department_name %> </p> <p> + <label><%= Chouette::Company.human_attribute_name("code") %>: </label> + <%= @company.code %> + </p> + <p> <label><%= Chouette::Company.human_attribute_name("phone") %>: </label> <%= @company.phone %> </p> @@ -35,6 +35,14 @@ <label><%= Chouette::Company.human_attribute_name("email") %>: </label> <%= @company.email %> </p> + <p> + <label><%= Chouette::Company.human_attribute_name("registration_number") %>: </label> + <%= @company.registration_number %> + </p> + <p> + <label><%= Chouette::Company.human_attribute_name("objectid") %>: </label> + <%= @company.objectid %> + </p> </div> </div> diff --git a/app/views/networks/_form.erb b/app/views/networks/_form.erb index e81bc7ce8..3476e5031 100644 --- a/app/views/networks/_form.erb +++ b/app/views/networks/_form.erb @@ -7,6 +7,14 @@ <%= form.input :description %> <%= form.input :source_name %> <%= form.input :source_identifier %> + <% if @network.new_record? %> + <%= form.input :objectid %> + <% else %> + <li> + <label><%= @network.human_attribute_name("objectid") %>: </label> + <%= @network.objectid %> + </li> + <% end %> <% end %> <%= form.buttons do %> diff --git a/app/views/networks/_network.erb b/app/views/networks/_network.erb index 4adf6896b..f3a0b597e 100644 --- a/app/views/networks/_network.erb +++ b/app/views/networks/_network.erb @@ -1,6 +1,9 @@ <%= div_for(network) do %> <%= link_to network.name, [@referential, network] %> <div class="info"> - + <div class="actions"> + <%= link_to t("actions.edit"), edit_referential_network_path(@referential, network), :class => "edit" %> | + <%= link_to t("actions.destroy"), referential_network_path(@referential, network), :method => :delete, :confirm => t('networks.actions.destroy_confirm'), :class => "remove" %> + </div> </div> <% end %> diff --git a/app/views/networks/index.html.erb b/app/views/networks/index.html.erb index 3743a1865..96e4f8b0b 100644 --- a/app/views/networks/index.html.erb +++ b/app/views/networks/index.html.erb @@ -1,6 +1,19 @@ <%= title_tag t('networks.index.title') %> -<%= render :partial => "network", :collection => @networks %> +<%= search_form_for @q, :url => referential_networks_path(@referential), :html => {:method => :get} do |f| %> + <%= f.label :name_cont, "#{t('.name')} :" %> + <%= f.text_field :name_cont %> + + <%= f.submit t('actions.search') %> <%= t("or") %> + <%= link_to t("cancel"), referential_networks_path(@referential) %> +<% end %> + +<%#= will_paginate @networks %> +<div class="networks paginated_content"> + <%= render :partial => "network", :collection => @networks %> +</div> +<%= will_paginate @networks %> + <% content_for :sidebar do %> <ul class="actions"> diff --git a/app/views/networks/show.html.erb b/app/views/networks/show.html.erb index 489978f49..bd96938c5 100644 --- a/app/views/networks/show.html.erb +++ b/app/views/networks/show.html.erb @@ -31,6 +31,10 @@ <label><%= Chouette::Network.human_attribute_name("source_identifier") %>: </label> <%= @network.source_identifier %> </p> + <p> + <label><%= Chouette::Network.human_attribute_name("objectid") %>: </label> + <%= @network.objectid %> + </p> </div> </div> |
