Unified hash options style
This commit is contained in:
parent
1982f3b526
commit
158685459d
@ -1,5 +1,5 @@
|
||||
<h2><%= t ".heading" %></h2>
|
||||
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'body_trackers/sidebar' %>
|
||||
<%= render partial: 'body_trackers/sidebar' %>
|
||||
<% end %>
|
||||
|
@ -1,6 +1,6 @@
|
||||
<% if User.current.allowed_to?(:manage_common, @project) %>
|
||||
<%= link_to t(".link_import_ingredients"), '#', :class => 'icon icon-multiple',
|
||||
:onclick => '$("#import-ingredients").show(); $("#filename").focus(); return false;' %>
|
||||
<%= link_to t(".link_new_ingredient"), '#', :class => 'icon icon-add',
|
||||
:onclick => '$("#add-ingredient").show(); $("#ingredient_name").focus(); return false;' %>
|
||||
<%= link_to t(".link_import_ingredients"), '#', class: 'icon icon-multiple',
|
||||
onclick: '$("#import-ingredients").show(); $("#filename").focus(); return false;' %>
|
||||
<%= link_to t(".link_new_ingredient"), '#', class: 'icon icon-add',
|
||||
onclick: '$("#add-ingredient").show(); $("#ingredient_name").focus(); return false;' %>
|
||||
<% end %>
|
||||
|
@ -2,8 +2,8 @@
|
||||
<h2><%= t ".heading_new_ingredient" %></h2>
|
||||
|
||||
<%= labelled_form_for @ingredient,
|
||||
:url => project_ingredients_path(@project),
|
||||
:html => {:id => 'ingredient-form'} do |f| %>
|
||||
url: project_ingredients_path(@project),
|
||||
html: {id: 'ingredient-form'} do |f| %>
|
||||
<%= error_messages_for @ingredient %>
|
||||
|
||||
<div class="box tabular">
|
||||
@ -33,19 +33,20 @@
|
||||
<%= ff.select :unit_id, unit_options, {label: ''} %>
|
||||
<%= ff.check_box :_destroy, {style: "display:none", label: ''} %>
|
||||
<%= link_to t(".button_delete_nutrient"), '#',
|
||||
:class => 'icon icon-del',
|
||||
:style => (@ingredient.nutrients.length > 1 ? "" : "display:none"),
|
||||
:onclick => "deleteNutrient(); return false;" %>
|
||||
class: 'icon icon-del',
|
||||
style: (@ingredient.nutrients.length > 1 ? "" : "display:none"),
|
||||
onclick: "deleteNutrient(); return false;" %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<p>
|
||||
<%= link_to t(".button_add_nutrient"), '#', :class => 'icon icon-add',
|
||||
:onclick => 'addNutrient(); return false;' %>
|
||||
<%= link_to t(".button_add_nutrient"), '#', class: 'icon icon-add',
|
||||
onclick: 'addNutrient(); return false;' %>
|
||||
</p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-ingredient").hide()' %>
|
||||
<%= link_to l(:button_cancel), "#",
|
||||
onclick: '$("#add-ingredient").hide(); return false;' %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
|
@ -2,8 +2,8 @@
|
||||
<h2><%= t ".heading_import_ingredients" %></h2>
|
||||
|
||||
<%= form_tag import_project_ingredients_path(@project),
|
||||
:multipart => true,
|
||||
:id => 'import-form' do %>
|
||||
multipart: true,
|
||||
id: 'import-form' do %>
|
||||
<div class="box tabular">
|
||||
<p>
|
||||
<label><%= t ".label_import_select_csv_file" %></label>
|
||||
@ -14,7 +14,8 @@
|
||||
</p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_import) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#import-ingredients").hide()' %>
|
||||
<%= link_to l(:button_cancel), "#",
|
||||
onclick: '$("#import-ingredients").hide(); return false;' %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%= render :partial => 'ingredients/filters',
|
||||
:locals => {:url => filter_project_ingredients_path(@project)} %>
|
||||
<%= render partial: 'ingredients/filters',
|
||||
locals: {url: filter_project_ingredients_path(@project)} %>
|
||||
|
||||
<% if @ingredients.any? { |i| i.persisted? } %>
|
||||
<table class="list">
|
||||
|
@ -1,8 +1,8 @@
|
||||
<%= render :partial => 'ingredients/filters',
|
||||
:locals => {:url => filter_nutrients_project_ingredients_path(@project)} %>
|
||||
<%= render partial: 'ingredients/filters',
|
||||
locals: {url: filter_nutrients_project_ingredients_path(@project)} %>
|
||||
|
||||
<% if @nutrients.any? %>
|
||||
<%= render :partial => 'ingredients/options' %>
|
||||
<%= render partial: 'ingredients/options' %>
|
||||
|
||||
<table class="nutrients list odd-even">
|
||||
<thead>
|
||||
|
@ -1,18 +1,18 @@
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'body_trackers/sidebar' %>
|
||||
<%= render partial: 'body_trackers/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="contextual">
|
||||
<%= link_to t(".heading_nutrient_view"), nutrients_project_ingredients_path(@project),
|
||||
:class => 'icon icon-stats' %>
|
||||
<%= render :partial => 'ingredients/contextual' %>
|
||||
class: 'icon icon-stats' %>
|
||||
<%= render partial: 'ingredients/contextual' %>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'ingredients/import' %>
|
||||
<%= render partial: 'ingredients/import' %>
|
||||
|
||||
<%= render :partial => 'ingredients/form' %>
|
||||
<%= render partial: 'ingredients/form' %>
|
||||
|
||||
<h2><%= t ".heading" %></h2>
|
||||
<div id='ingredients'>
|
||||
<%= render :partial => 'ingredients/list' %>
|
||||
<%= render partial: 'ingredients/list' %>
|
||||
</div>
|
||||
|
@ -1,18 +1,18 @@
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'body_trackers/sidebar' %>
|
||||
<%= render partial: 'body_trackers/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="contextual">
|
||||
<%= link_to t(".heading_ingredient_list"), project_ingredients_path(@project),
|
||||
:class => 'icon icon-list' %>
|
||||
<%= render :partial => 'ingredients/contextual' %>
|
||||
class: 'icon icon-list' %>
|
||||
<%= render partial: 'ingredients/contextual' %>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'ingredients/import' %>
|
||||
<%= render partial: 'ingredients/import' %>
|
||||
|
||||
<%= render :partial => 'ingredients/form' %>
|
||||
<%= render partial: 'ingredients/form' %>
|
||||
|
||||
<h2><%= t ".heading" %></h2>
|
||||
<div id='nutrients'>
|
||||
<%= render :partial => 'ingredients/list_nutrients' %>
|
||||
<%= render partial: 'ingredients/list_nutrients' %>
|
||||
</div>
|
||||
|
@ -1,3 +1,3 @@
|
||||
$('div[id^=flash_]').remove();
|
||||
$('#content').prepend('<%= escape_javascript(render_flash_messages) %>');
|
||||
$('#ingredients').html('<%= escape_javascript(render :partial => 'ingredients/list') %>');
|
||||
$('#ingredients').html('<%= escape_javascript(render partial: 'ingredients/list') %>');
|
||||
|
@ -1,3 +1,3 @@
|
||||
$('div[id^=flash_]').remove();
|
||||
$('#content').prepend('<%= escape_javascript(render_flash_messages) %>');
|
||||
$('#nutrients').html('<%= escape_javascript(render :partial => 'ingredients/list_nutrients') %>');
|
||||
$('#nutrients').html('<%= escape_javascript(render partial: 'ingredients/list_nutrients') %>');
|
||||
|
@ -1,3 +1,3 @@
|
||||
<% content_for :header_tags do %>
|
||||
<%= stylesheet_link_tag 'body_tracking', :plugin => 'body_tracking' %>
|
||||
<%= stylesheet_link_tag 'body_tracking', plugin: 'body_tracking' %>
|
||||
<% end %>
|
||||
|
@ -2,8 +2,8 @@
|
||||
<h2><%= t ".heading_new_measurement" %></h2>
|
||||
|
||||
<%= labelled_form_for @measurement,
|
||||
:url => project_measurements_path(@project),
|
||||
:html => {:id => 'measurement-form'} do |f| %>
|
||||
url: project_measurements_path(@project),
|
||||
html: {id: 'measurement-form'} do |f| %>
|
||||
<%= error_messages_for @measurement %>
|
||||
|
||||
<div class="box tabular">
|
||||
@ -17,19 +17,20 @@
|
||||
<%= ff.select :unit_id, unit_options, {label: ''} %>
|
||||
<%= ff.check_box :_destroy, {style: "display:none", label: ''} %>
|
||||
<%= link_to t(".button_delete_readout"), '#',
|
||||
:class => 'icon icon-del',
|
||||
:style => (@measurement.readouts.length > 1 ? "" : "display:none"),
|
||||
:onclick => "deleteReadout(); return false;" %>
|
||||
class: 'icon icon-del',
|
||||
style: (@measurement.readouts.length > 1 ? "" : "display:none"),
|
||||
onclick: "deleteReadout(); return false;" %>
|
||||
</p>
|
||||
<% end %>
|
||||
<% end %>
|
||||
<p>
|
||||
<%= link_to t(".button_add_readout"), '#', :class => 'icon icon-add',
|
||||
:onclick => 'addReadout(); return false;' %>
|
||||
<%= link_to t(".button_add_readout"), '#', class: 'icon icon-add',
|
||||
onclick: 'addReadout(); return false;' %>
|
||||
</p>
|
||||
</div>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-measurement").hide()' %>
|
||||
<%= link_to l(:button_cancel), "#",
|
||||
onclick: '$("#add-measurement").hide(); return false;' %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
|
@ -1,17 +1,17 @@
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'body_trackers/sidebar' %>
|
||||
<%= render partial: 'body_trackers/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="contextual">
|
||||
<% if User.current.allowed_to?(:manage_common, @project) %>
|
||||
<%= link_to t(".link_new_measurement"), '#', :class => 'icon icon-add',
|
||||
:onclick => '$("#add-measurement").show(); $("#measurement_name").focus(); return false;' %>
|
||||
<%= link_to t(".link_new_measurement"), '#', class: 'icon icon-add',
|
||||
onclick: '$("#add-measurement").show(); $("#measurement_name").focus(); return false;' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<%= render :partial => 'measurements/form' %>
|
||||
<%= render partial: 'measurements/form' %>
|
||||
|
||||
<h2><%= t ".heading" %></h2>
|
||||
<div id='measurements'>
|
||||
<%= render :partial => 'measurements/list' %>
|
||||
<%= render partial: 'measurements/list' %>
|
||||
</div>
|
||||
|
@ -1,5 +1,5 @@
|
||||
<%= render :partial => 'quantities/filters',
|
||||
:locals => {:url => filter_project_quantities_path(@project)} %>
|
||||
<%= render partial: 'quantities/filters',
|
||||
locals: {url: filter_project_quantities_path(@project)} %>
|
||||
|
||||
<% if @quantities.any? { |q| q.persisted? } %>
|
||||
<table class="list">
|
||||
@ -68,7 +68,7 @@
|
||||
<%= labelled_form_for @quantity, url: quantity_path(@quantity), method: :patch,
|
||||
remote: true, html: {id: 'quantity-edit-form'} do |f| %>
|
||||
|
||||
<%= render :partial => 'quantities/form', :locals => { :f => f } %>
|
||||
<%= render partial: 'quantities/form', locals: {f: f} %>
|
||||
<%= submit_tag l(:button_save) %>
|
||||
<%=
|
||||
link_to l(:button_cancel), "#",
|
||||
|
@ -1,11 +1,11 @@
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'body_trackers/sidebar' %>
|
||||
<%= render partial: 'body_trackers/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="contextual">
|
||||
<% if User.current.allowed_to?(:manage_common, @project) %>
|
||||
<%= link_to t(".link_new_quantity"), '#', :class => 'icon icon-add',
|
||||
:onclick => '$("#add-quantity").toggle(); $("#quantity_name").focus(); return false;' %>
|
||||
<%= link_to t(".link_new_quantity"), '#', class: 'icon icon-add',
|
||||
onclick: '$("#add-quantity").toggle(); $("#quantity_name").focus(); return false;' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@ -13,9 +13,9 @@
|
||||
<h2><%= t ".heading_new_quantity" %></h2>
|
||||
|
||||
<%= labelled_form_for @quantity,
|
||||
:url => project_quantities_path(@project),
|
||||
:html => {:id => 'quantity-add-form'} do |f| %>
|
||||
<%= render :partial => 'quantities/form', :locals => { :f => f } %>
|
||||
url: project_quantities_path(@project),
|
||||
html: {id: 'quantity-add-form'} do |f| %>
|
||||
<%= render partial: 'quantities/form', locals: {f: f} %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to l(:button_cancel), "#", onclick: '$("#add-quantity").hide(); return false;' %>
|
||||
<% end %>
|
||||
@ -24,5 +24,5 @@
|
||||
|
||||
<h2><%= t ".heading" %></h2>
|
||||
<div id='quantities'>
|
||||
<%= render :partial => 'quantities/index' %>
|
||||
<%= render partial: 'quantities/index' %>
|
||||
</div>
|
||||
|
@ -1,4 +1,4 @@
|
||||
$('div[id^=flash_]').remove();
|
||||
$('#content').prepend('<%= escape_javascript(render_flash_messages) %>');
|
||||
$('#quantities').html('<%= escape_javascript(render :partial => 'quantities/index') %>');
|
||||
$('#quantities').html('<%= escape_javascript(render partial: 'quantities/index') %>');
|
||||
$('#quantity_domain').trigger('change');
|
||||
|
@ -1,11 +1,11 @@
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'body_trackers/sidebar' %>
|
||||
<%= render partial: 'body_trackers/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="contextual">
|
||||
<% if User.current.allowed_to?(:manage_common, @project) %>
|
||||
<%= link_to t(".link_new_source"), '#', :class => 'icon icon-add',
|
||||
:onclick => '$("#add-source").show(); $("#source_name").focus(); return false;' %>
|
||||
<%= link_to t(".link_new_source"), '#', class: 'icon icon-add',
|
||||
onclick: '$("#add-source").show(); $("#source_name").focus(); return false;' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@ -13,11 +13,11 @@
|
||||
<h2><%= t ".heading_new_source" %></h2>
|
||||
|
||||
<%= labelled_form_for @source,
|
||||
:url => project_sources_path(@project),
|
||||
:html => {:id => 'source-form'} do |f| %>
|
||||
<%= render :partial => 'sources/form', :locals => { :f => f } %>
|
||||
url: project_sources_path(@project),
|
||||
html: {id: 'source-form'} do |f| %>
|
||||
<%= render partial: 'sources/form', locals: {f: f} %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-source").hide()' %>
|
||||
<%= link_to l(:button_cancel), "#", onclick: '$("#add-source").hide(); return false;' %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
|
@ -1,11 +1,11 @@
|
||||
<% content_for :sidebar do %>
|
||||
<%= render :partial => 'body_trackers/sidebar' %>
|
||||
<%= render partial: 'body_trackers/sidebar' %>
|
||||
<% end %>
|
||||
|
||||
<div class="contextual">
|
||||
<% if User.current.allowed_to?(:manage_common, @project) %>
|
||||
<%= link_to t(".link_new_unit"), '#', :class => 'icon icon-add',
|
||||
:onclick => '$("#add-unit").show(); $("#unit_shortname").focus(); return false;' %>
|
||||
<%= link_to t(".link_new_unit"), '#', class: 'icon icon-add',
|
||||
onclick: '$("#add-unit").show(); $("#unit_shortname").focus(); return false;' %>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
@ -13,11 +13,11 @@
|
||||
<h2><%= t ".heading_new_unit" %></h2>
|
||||
|
||||
<%= labelled_form_for @unit,
|
||||
:url => project_units_path(@project),
|
||||
:html => {:id => 'unit-form'} do |f| %>
|
||||
<%= render :partial => 'units/form', :locals => { :f => f } %>
|
||||
url: project_units_path(@project),
|
||||
html: {id: 'unit-form'} do |f| %>
|
||||
<%= render partial: 'units/form', locals: {f: f} %>
|
||||
<%= submit_tag l(:button_create) %>
|
||||
<%= link_to l(:button_cancel), "#", :onclick => '$("#add-unit").hide()' %>
|
||||
<%= link_to l(:button_cancel), "#", onclick: '$("#add-unit").hide(); return false;' %>
|
||||
<% end %>
|
||||
<hr>
|
||||
</div>
|
||||
|
@ -3,13 +3,13 @@
|
||||
|
||||
resources :projects do
|
||||
shallow do
|
||||
resources :body_trackers, :only => [:index] do
|
||||
resources :body_trackers, only: [:index] do
|
||||
post 'defaults', on: :collection
|
||||
end
|
||||
resources :measurements, :only => [:index, :create, :destroy] do
|
||||
resources :measurements, only: [:index, :create, :destroy] do
|
||||
post 'toggle', on: :member
|
||||
end
|
||||
resources :ingredients, :only => [:index, :create, :destroy] do
|
||||
resources :ingredients, only: [:index, :create, :destroy] do
|
||||
post 'toggle', on: :member
|
||||
collection do
|
||||
get 'nutrients'
|
||||
@ -19,8 +19,8 @@ resources :projects do
|
||||
post 'import'
|
||||
end
|
||||
end
|
||||
resources :sources, :only => [:index, :create, :destroy]
|
||||
resources :quantities, :only => [:index, :create, :edit, :update, :destroy] do
|
||||
resources :sources, only: [:index, :create, :destroy]
|
||||
resources :quantities, only: [:index, :create, :edit, :update, :destroy] do
|
||||
member do
|
||||
post 'toggle'
|
||||
post 'move/:direction', to: 'quantities#move', as: :move
|
||||
@ -30,6 +30,6 @@ resources :projects do
|
||||
get 'filter'
|
||||
end
|
||||
end
|
||||
resources :units, :only => [:index, :create, :destroy]
|
||||
resources :units, only: [:index, :create, :destroy]
|
||||
end
|
||||
end
|
||||
|
@ -16,8 +16,8 @@ class CreateSchema < ActiveRecord::Migration
|
||||
t.boolean :primary
|
||||
# fields for awesome_nested_set
|
||||
t.references :parent
|
||||
t.integer :lft, :null => false, :index => true
|
||||
t.integer :rgt, :null => false, :index => true
|
||||
t.integer :lft, null: false, index: true
|
||||
t.integer :rgt, null: false, index: true
|
||||
t.timestamps null: false
|
||||
end
|
||||
|
||||
|
28
init.rb
28
init.rb
@ -15,23 +15,23 @@ Redmine::Plugin.register :body_tracking do
|
||||
|
||||
project_module :body_tracking do
|
||||
permission :view_body_trackers, {
|
||||
:body_trackers => [:index],
|
||||
:measurements => [:index],
|
||||
:ingredients => [:index, :nutrients, :filter, :filter_nutrients],
|
||||
:sources => [:index],
|
||||
:quantities => [:index, :parents, :filter],
|
||||
:units => [:index],
|
||||
body_trackers: [:index],
|
||||
measurements: [:index],
|
||||
ingredients: [:index, :nutrients, :filter, :filter_nutrients],
|
||||
sources: [:index],
|
||||
quantities: [:index, :parents, :filter],
|
||||
units: [:index],
|
||||
}, read: true
|
||||
permission :manage_common, {
|
||||
:body_trackers => [:defaults],
|
||||
:measurements => [:create, :destroy, :toggle],
|
||||
:ingredients => [:create, :destroy, :toggle, :import, :toggle_nutrient_column],
|
||||
:sources => [:create, :destroy],
|
||||
:quantities => [:create, :edit, :update, :destroy, :toggle, :move],
|
||||
:units => [:create, :destroy],
|
||||
body_trackers: [:defaults],
|
||||
measurements: [:create, :destroy, :toggle],
|
||||
ingredients: [:create, :destroy, :toggle, :import, :toggle_nutrient_column],
|
||||
sources: [:create, :destroy],
|
||||
quantities: [:create, :edit, :update, :destroy, :toggle, :move],
|
||||
units: [:create, :destroy],
|
||||
}, require: :loggedin
|
||||
end
|
||||
|
||||
menu :project_menu, :body_trackers, {:controller => 'body_trackers', :action => 'index'},
|
||||
:caption => :body_trackers_menu_caption, :before => :settings, :param => :project_id
|
||||
menu :project_menu, :body_trackers, {controller: 'body_trackers', action: 'index'},
|
||||
caption: :body_trackers_menu_caption, before: :settings, param: :project_id
|
||||
end
|
||||
|
Reference in New Issue
Block a user