Merge branch 'feature/widgets' of https://dev.finn.de/git/reporting-engine into feature/widgets

pull/6827/head
jwollert 14 years ago
commit f6039d1c08
  1. 1
      assets/javascripts/reporting.js
  2. 58
      assets/javascripts/reporting/controls.js
  3. 6
      assets/stylesheets/reporting.css
  4. 6
      lib/widget/controls/query_name.rb

@ -26,6 +26,7 @@ window.Reporting = {
Reporting.require("filters");
Reporting.require("group_bys");
Reporting.require("restore_query");
Reporting.require("controls");
//
// function hide_category(tr_field) {

@ -5,46 +5,42 @@ Reporting.Controls = {
query_name_editor: function (target_id) {
var target = $(target_id);
var isPublic = target.getAttribute("data-is_public") === "true";
var updateUrl = target.getAttribute("data-update_url");
var updateUrl = target.getAttribute("data-update-url");
var translations = target.getAttribute("data-translations");
if (translations.isJSON()) {
translations = translations.evalJSON(true);
} else {
}
if (translations === undefined) {
translations = {};
}
if (translations.rename === undefined) {
translations.rename = 'ok';
}
if (translations.cancel === undefined) {
translations.cancel = 'cancel';
}
if (translations.saving === undefined) {
translations.saving = 'Saving...';
}
if (translations.loading === undefined) {
translations.loading = 'Loading...';
}
if (translations.clickToEdit === undefined) {
translations.loading = 'Click to edit';
}
Ajax.InPlaceEditor(target_id, updateUrl, {
var editor = new Ajax.InPlaceEditor(target_id, updateUrl, {
callback: function (form, value) {
return 'query_is_public=' + (form.query_is_public.checked === true) + '&query_name=' + encodeURIComponent(value);
return 'query_name=' + encodeURIComponent(value);
},
okControl: 'button',
cancelControl: 'button',
externalControl: 'query-name-edit-button',
okText: translations.rename === undefined ? 'ok' : translations.rename,
cancelText: translations.cancel === undefined ? 'cancel' : translations.cancel,
savingText: translations.saving === undefined ? 'Saving...' : translations.saving,
loadingText: translations.loading === undefined ? 'Loading...' : translations.loading,
clickToEditText: translations.clickToEdit === undefined ? 'Click to edit' : translations.clickToEdit,
onFormCustomization: function (ipe, ipeForm) {
var label;
var checkbox;
var chk_id = 'rename_query_is_public';
checkbox = document.createElement('input');
checkbox.value = 1;
checkbox.type = 'checkbox';
checkbox.id = chk_id;
checkbox.name = 'query_is_public';
checkbox.checked = isPublic;
label = document.createElement('label');
label.id = 'in_place_save_is_public_question';
label.htmlFor = chk_id;
label.appendChild(document.createTextNode(translations.isPublic === undefined ? 'public?' : translations.isPublic));
ipeForm.insert(label);
ipeForm.insert(checkbox);
}
okText: translations.rename,
cancelText: translations.cancel,
savingText: translations.saving,
loadingText: translations.loading,
clickToEditText: translations.clickToEdit
});
},
@ -78,7 +74,9 @@ Reporting.Controls = {
};
Reporting.onload(function () {
Reporting.Controls.query_name_editor('query_saved_name');
if ($('query_saved_name').getAttribute("data-update-url") !== null) {
Reporting.Controls.query_name_editor('query_saved_name');
}
$("query-icon-delete").observe("click", Reporting.Controls.toggle_delete_form);
$("query-icon-save-as").observe("click", Reporting.Controls.toggle_save_as_form);
$("query-icon-save-as-cancel").observe("click", Reporting.Controls.toggle_save_as_form);

@ -183,8 +183,6 @@
.filter_rem {
overflow: hidden;
font-size: 0 !important;
line-height: 0 !important;
cursor: pointer;
background-repeat: no-repeat;
background-color: transparent;
@ -196,9 +194,7 @@
.icon-filter-rem {
background-image: url(../images/remove.png);
margin-top: 3px;
margin-right: 3px;
position: absolute;
position: relative;
}
.filter {

@ -1,6 +1,6 @@
class Widget::Controls::QueryName < Widget::Base
def render
options = { "data-translations" => translations }
options = { :id => "query_saved_name", "data-translations" => translations }
if @query.new_record?
name = l(:label_save_this_query)
icon = ""
@ -11,9 +11,9 @@ class Widget::Controls::QueryName < Widget::Base
l(:button_rename)
end
options["data-is_public"] = @query.is_public
options["data-update-url"] = url_for(:action => "update", :id => @query.id).html_safe
options["data-update-url"] = url_for(:action => "update", :id => @query.id)
end
content_tag(:span, name, :id => "query_saved_name") + icon
content_tag(:span, name, options) + icon
end
def translations

Loading…
Cancel
Save