transition all widgets to canvas api

pull/6827/head
Tim Felgentreff 14 years ago
parent d740f5f6e0
commit 753843fd33
  1. 3
      lib/widget/controls/apply.rb
  2. 4
      lib/widget/controls/clear.rb
  3. 2
      lib/widget/controls/delete.rb
  4. 2
      lib/widget/controls/query_name.rb
  5. 2
      lib/widget/controls/save.rb
  6. 2
      lib/widget/controls/save_as.rb
  7. 4
      lib/widget/filters.rb
  8. 4
      lib/widget/filters/date.rb
  9. 5
      lib/widget/filters/label.rb
  10. 11
      lib/widget/filters/multi_choice.rb
  11. 5
      lib/widget/filters/multi_values.rb
  12. 5
      lib/widget/filters/operators.rb
  13. 4
      lib/widget/filters/remove_button.rb
  14. 4
      lib/widget/filters/text_box.rb
  15. 4
      lib/widget/group_bys.rb
  16. 2
      lib/widget/settings.rb
  17. 4
      lib/widget/settings/fieldset.rb

@ -1,6 +1,7 @@
class Widget::Controls::Apply < Widget::Base
def render
link_to content_tag(:span, content_tag(:em, l(:button_apply))), {},
write link_to content_tag(:span, content_tag(:em, l(:button_apply))), {},
:href => "#", :id => "query-icon-apply-button",
:class => "button apply reporting_button",
:"data-target" => url_for(:action => 'index', :set_filter => '1')

@ -1,5 +1,7 @@
class Widget::Controls::Clear < Widget::Base
def render
link_to content_tag(:span, content_tag(:em, l(:"button_clear"), :class => "button-icon icon-clear")), '#', :id => 'query-link-clear', :class => 'button secondary'
write link_to(content_tag(:span, content_tag(:em, l(:"button_clear"), :class => "button-icon icon-clear")),
'#', :id => 'query-link-clear', :class => 'button secondary')
end
end

@ -19,6 +19,6 @@ class Widget::Controls::Delete < Widget::Base
end
question + options
end
button + popup
write(button + popup)
end
end

@ -14,7 +14,7 @@ class Widget::Controls::QueryName < Widget::Base
options["data-update-url"] = url_for(:action => "rename", :id => @query.id)
options["data-is_new"] = @query.new_record?
end
content_tag(:span, name, options) + icon
write(content_tag(:span, name, options) + icon)
end
def translations

@ -1,7 +1,7 @@
class Widget::Controls::Save < Widget::Base
def render
return "" if @query.new_record?
link_to content_tag(:span, content_tag(:em, l(:button_save)), :class => "button-icon icon-save"), {},
write link_to content_tag(:span, content_tag(:em, l(:button_save)), :class => "button-icon icon-save"), {},
:href => "#", :id => "query-breadcrumb-save",
:class => "button secondary",
:title => l(:button_save),

@ -10,7 +10,7 @@ class Widget::Controls::SaveAs < Widget::Base
button = link_to content_tag(:span, content_tag(:em, link_name, :class => "button-icon icon-save-as")), "#",
:class => "button secondary",
:id => 'query-icon-save-as', :title => link_name
button + render_popup
write(button + render_popup)
end
def render_popup_form

@ -17,7 +17,7 @@ class Widget::Filters < Widget::Base
:class => "select-small",
:name => nil
end
content_tag(:div, table + select)
write content_tag(:div, table + select)
end
def selectables
@ -72,4 +72,4 @@ class Widget::Filters < Widget::Base
end
render_widget Filters::RemoveButton, f, :to => html
end
end
end

@ -23,7 +23,7 @@ class Widget::Filters::Date < Widget::Filters::Base
name = "values[#{filter_class.underscore_name}][]"
id_prefix = "#{filter_class.underscore_name}_"
content_tag :td do
write(content_tag :td do
arg1 = content_tag :span, :id => "#{id_prefix}arg_1", :class => "filter_values" do
text1 = text_field_tag name, @filter.values.first.to_s, :size => 10, :class => "select-small", :id => "#{id_prefix}arg_1_val"
cal1 = calendar_for("#{id_prefix}arg_1_val")
@ -35,6 +35,6 @@ class Widget::Filters::Date < Widget::Filters::Base
text2 + cal2
end
arg1 + arg2
end
end)
end
end

@ -1,6 +1,7 @@
class Widget::Filters::Label < Widget::Filters::Base
def render
content_tag :td, :width => 150 do
write(content_tag :td, :width => 150 do
options = { :id => filter_class.underscore_name }
if (engine::Filter.all.any? {|f| f.dependent == filter_class})
options.merge! :class => 'dependent-filter-label'
@ -8,6 +9,6 @@ class Widget::Filters::Label < Widget::Filters::Base
content_tag :label, options do
l(filter_class.label)
end
end
end)
end
end

@ -1,8 +1,9 @@
class Widget::Filters::MultiChoice < Widget::Filters::Base
def render
filterName = filter_class.underscore_name
content_tag :td do
write(content_tag :td do
content_tag :div, :id => "#{filterName}_arg_1", :class => "filter_values" do
choices = filter_class.available_values.each_with_index.map do |(label, value), i|
opts = {
@ -21,11 +22,11 @@ class Widget::Filters::MultiChoice < Widget::Filters::Base
content_tag :div, choices.join.html_safe,
:id => "#{filter_class.underscore_name}_arg_1_val"
end
end
end)
end
private
def translate(label)
if label.is_a?(Symbol)
::I18n.t(label)
@ -33,5 +34,5 @@ class Widget::Filters::MultiChoice < Widget::Filters::Base
label
end
end
end

@ -1,7 +1,8 @@
class Widget::Filters::MultiValues < Widget::Filters::Base
def render
content_tag :td do
write(content_tag :td do
content_tag :div, :id => "#{filter_class.underscore_name}_arg_1", :class => "filter_values" do
select_options = { :style => "vertical-align: top;", # FIXME: Do CSS
:name => "values[#{filter_class.underscore_name}][]",
@ -52,6 +53,6 @@ class Widget::Filters::MultiValues < Widget::Filters::Base
:"data-filter-name" => filter_class.underscore_name
box + plus
end
end
end)
end
end

@ -1,6 +1,7 @@
class Widget::Filters::Operators < Widget::Filters::Base
def render
content_tag :td, :width => 100 do
write(content_tag :td, :width => 100 do
hide_select_box = filter_class.available_operators.count == 1
options = {:class => "select-small filters-select filter_operator",
:style => "vertical-align: top", # FIXME: put into CSS
@ -19,6 +20,6 @@ class Widget::Filters::Operators < Widget::Filters::Base
l(filter_class.available_operators.first.label)
end
hide_select_box ? select_box + label : select_box
end
end)
end
end

@ -1,11 +1,11 @@
class Widget::Filters::RemoveButton < Widget::Filters::Base
def render
content_tag :td, :width => "25px" do
write( content_tag :td, :width => "25px" do
hidden_field = tag :input, :id => "rm_#{filter_class.underscore_name}",
:name => "fields[]", :type => "hidden", :value => ""
button = tag :input, :type => "button", :value => "",
:class => "icon filter_rem icon-filter-rem"
content_tag(:div, hidden_field + button, :id => "rm_box_#{filter_class.underscore_name}", :class => "remove-box")
end
end)
end
end

@ -1,6 +1,6 @@
class Widget::Filters::TextBox < Widget::Filters::Base
def render
content_tag :td do
write(content_tag :td do
content_tag :div, :id => "#{filter_class.underscore_name}_arg_1", :class => "filter_values" do
text_field_tag("values[#{filter_class.underscore_name}]", "",
:size => "6",
@ -8,6 +8,6 @@ class Widget::Filters::TextBox < Widget::Filters::Base
:id => "#{filter_class.underscore_name}_arg_1_val",
:'data-filter-name' => filter_class.underscore_name)
end
end
end)
end
end

@ -51,10 +51,10 @@ class Widget::GroupBys < Widget::Base
end
def render
content_tag :div, :id => 'group_by_area' do
write(content_tag :div, :id => 'group_by_area' do
out = render_group 'columns', @query.group_bys(:column)
out += render_group 'rows', @query.group_bys(:row)
out.html_safe
end
end)
end
end

@ -19,7 +19,7 @@ class Widget::Settings < Widget::Base
render_widget(Widget::Controls::Delete, @query, :to => widgets)
end
fieldsets + controls
write(fieldsets + controls)
end
end
end

@ -7,9 +7,9 @@ class Widget::Settings::Fieldset < Widget::Base
end
def render
content_tag :fieldset, :id => @id, :class => "collapsible collapsed" do
write(content_tag :fieldset, :id => @id, :class => "collapsible collapsed" do
html = content_tag :legend, l(@label), :onclick => "toggleFieldset(this);" #FIXME: onclick
html + yield
end
end)
end
end

Loading…
Cancel
Save