summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/custom_field_enumerations/create.js.erb2
-rw-r--r--app/views/custom_field_enumerations/destroy.html.erb14
-rw-r--r--app/views/custom_field_enumerations/index.html.erb49
-rw-r--r--app/views/custom_fields/formats/_enumeration.erb12
4 files changed, 77 insertions, 0 deletions
diff --git a/app/views/custom_field_enumerations/create.js.erb b/app/views/custom_field_enumerations/create.js.erb
new file mode 100644
index 000000000..9a9d40433
--- /dev/null
+++ b/app/views/custom_field_enumerations/create.js.erb
@@ -0,0 +1,2 @@
+$('#content').html('<%= escape_javascript(render(:template => 'custom_field_enumerations/index')) %>');
+$('#custom_field_enumeration_name').focus();
diff --git a/app/views/custom_field_enumerations/destroy.html.erb b/app/views/custom_field_enumerations/destroy.html.erb
new file mode 100644
index 000000000..d2ae2ed79
--- /dev/null
+++ b/app/views/custom_field_enumerations/destroy.html.erb
@@ -0,0 +1,14 @@
+<%= title [l(:label_custom_field_plural), custom_fields_path],
+ [l(@custom_field.type_name), custom_fields_path(:tab => @custom_field.class.name)],
+ @custom_field.name %>
+
+<%= form_tag(custom_field_enumeration_path(@custom_field, @value), :method => :delete) do %>
+<div class="box">
+<p><strong><%= l(:text_enumeration_destroy_question, :name => @value.name, :count => @value.objects_count) %></strong></p>
+<p><label for='reassign_to_id'><%= l(:text_enumeration_category_reassign_to) %></label>
+<%= select_tag('reassign_to_id', content_tag('option', "--- #{l(:actionview_instancetag_blank_option)} ---", :value => '') + options_from_collection_for_select(@enumerations, 'id', 'name')) %></p>
+</div>
+
+<%= submit_tag l(:button_apply) %>
+<%= link_to l(:button_cancel), custom_field_enumerations_path(@custom_field) %>
+<% end %>
diff --git a/app/views/custom_field_enumerations/index.html.erb b/app/views/custom_field_enumerations/index.html.erb
new file mode 100644
index 000000000..9ca9314eb
--- /dev/null
+++ b/app/views/custom_field_enumerations/index.html.erb
@@ -0,0 +1,49 @@
+<%= title [l(:label_custom_field_plural), custom_fields_path],
+ [l(@custom_field.type_name), custom_fields_path(:tab => @custom_field.class.name)],
+ @custom_field.name %>
+
+<% if @custom_field.enumerations.any? %>
+<%= form_tag custom_field_enumerations_path(@custom_field), :method => 'put' do %>
+<div class="box">
+ <ul id="custom_field_enumerations" class="flat">
+ <% @custom_field.enumerations.each_with_index do |value, position| %>
+ <li>
+ <span class="sort-handle ui-icon ui-icon-arrowthick-2-n-s"></span>
+ <%= hidden_field_tag "custom_field_enumerations[#{value.id}][position]", position, :class => 'position' %>
+ <%= text_field_tag "custom_field_enumerations[#{value.id}][name]", value.name, :size => 40 %>
+ <%= hidden_field_tag "custom_field_enumerations[#{value.id}][active]", 0 %>
+ <label>
+ <%= check_box_tag "custom_field_enumerations[#{value.id}][active]", 1, value.active? %>
+ <%= l(:field_active) %>
+ </label>
+ <%= delete_link custom_field_enumeration_path(@custom_field, value) %>
+ </li>
+ <% end %>
+ </ul>
+</div>
+<p>
+ <%= submit_tag(l(:button_save)) %> |
+ <%= link_to l(:button_back), edit_custom_field_path(@custom_field) %>
+</p>
+<% end %>
+<% end %>
+
+<p><%= l(:label_enumeration_new) %></p>
+
+<%= form_tag custom_field_enumerations_path(@custom_field), :method => 'post', :remote => true do %>
+ <p><%= text_field_tag 'custom_field_enumeration[name]', '', :size => 40 %>
+ <%= submit_tag(l(:button_add)) %></p>
+<% end %>
+
+<%= javascript_tag do %>
+$(function() {
+ $("#custom_field_enumerations").sortable({
+ handle: ".sort-handle",
+ update: function(event, ui) {
+ $("#custom_field_enumerations li").each(function(){
+ $(this).find("input.position").val($(this).index()+1);
+ });
+ }
+ });
+});
+<% end %>
diff --git a/app/views/custom_fields/formats/_enumeration.erb b/app/views/custom_fields/formats/_enumeration.erb
new file mode 100644
index 000000000..07e4cf463
--- /dev/null
+++ b/app/views/custom_fields/formats/_enumeration.erb
@@ -0,0 +1,12 @@
+<% unless @custom_field.new_record? %>
+<p>
+ <label><%= l(:field_possible_values) %></label>
+ <%= link_to l(:button_edit), custom_field_enumerations_path(@custom_field), :class => 'icon icon-edit' %>
+</p>
+<% if @custom_field.enumerations.active.any? %>
+ <p><%= f.select :default_value, @custom_field.enumerations.active.map{|v| [v.name, v.id.to_s]}, :include_blank => true %></p>
+<% end %>
+<% end %>
+
+<p><%= f.text_field :url_pattern, :size => 50, :label => :label_link_values_to %></p>
+<p><%= edit_tag_style_tag f %></p>