Commit b4d86a8a authored by Mario Manno's avatar Mario Manno

remove obsolete link_to_function from notifications view

parent 6c664d94
$(function() {
NotificationDefaults = {
fill: function(options) {
var id = options.id;
var code = $('div#'+id+' select option:selected').text();
NotificationDefaults._fetch(id, code);
},
_fetch: function(id, code) {
$.ajax({
type: "GET",
dataType: "json",
url: '#{ call_for_papers_default_notifications_path(conference_acronym: @conference.acronym) }',
data: {'code':code},
success: function(result){
var texts = result.notification;
var topDiv = $('div#'+id);
var inputs = topDiv.find('input[type=text]');
$(inputs.get(0)).val(texts.accept_subject);
$(inputs.get(1)).val(texts.reject_subject);
inputs = topDiv.find('textarea');
$(inputs.get(0)).val(texts.accept_body);
$(inputs.get(1)).val(texts.reject_body);
}
});
},
};
$('[data-function="notification-defaults"]').click(function(){
var uuid = $(this).data("uuid")
NotificationDefaults.fill({ id: uuid });
return false;
});
});
......@@ -3,37 +3,3 @@
= dynamic_association :notifications, t(:notifications), f
= f.buttons do
= f.commit_button :button_html => {:class => "btn primary"}
:javascript
$(function() {
NotificationDefaults = {
fill: function(options) {
var id = options.id;
var code = $('div#'+id+' select option:selected').text();
NotificationDefaults._fetch(id, code);
},
_fetch: function(id, code) {
$.ajax({
type: "GET",
dataType: "json",
url: '#{ call_for_papers_default_notifications_path(conference_acronym: @conference.acronym) }',
data: {'code':code},
success: function(result){
var texts = result.notification;
var topDiv = $('div#'+id);
var inputs = topDiv.find('input[type=text]');
$(inputs.get(0)).val(texts.accept_subject);
$(inputs.get(1)).val(texts.reject_subject);
inputs = topDiv.find('textarea');
$(inputs.get(0)).val(texts.accept_body);
$(inputs.get(1)).val(texts.reject_body);
}
});
},
};
});
- uuid = "nf#{get_uuid}"
%div{ :id => uuid }
= f.inputs do
= link_to_function "use default text", "NotificationDefaults.fill({ id: '#{uuid}' });", style: 'float:right'
= link_to "use default text", "#", style: 'float:right', data: { function: 'notification-defaults', args: "#{uuid}" }
= f.input :locale, as: :select, collection: available_locales(@conference), hint: "Available locales for this conference and its speakers"
= f.input "accept_subject", label: 'Accept subject'
= f.input "accept_body", label: 'Accept body', as: :text
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment