OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openproject/app/views/watchers/set_watcher.js.erb

19 lines
462 B

<%
@replace_selectors.each do |selector|
next if selector.blank?
options = { replace: @replace_selectors }
last_selector = selector.split(' ').last
if last_selector.starts_with? '.'
options[:class] = last_selector[1..-1]
elsif last_selector.starts_with? '#'
options[:id] = last_selector[1..-1]
end
content = watcher_link(@watched, @user, options)
%>
jQuery("<%= selector %>").replaceWith("<%= escape_javascript(content) %>");
<% end %>