Sha256: 1db9a2e873f1b605d215b46330ccb2ca11aca5534445a60fdb1e9673fb9431de
Contents?: true
Size: 1.77 KB
Versions: 1
Compression:
Stored size: 1.77 KB
Contents
module UcbRails module Renderer class LdapPersonSearchResultLink < Base attr_accessor :entry def initialize(template, entry, options={}) super template, options self.entry = entry end def html exists? ? exists_html : button(text, :mini, :primary, link_options) end private def exists? ldap_person_search_existing_uids.include?(entry.uid.to_s) end def exists_html params["result-link-exists-text"] || 'Exists' end def text @text ||= params["result-link-text"].presence || "Add" end def link_options { class: classes, url: item_url, data: { remote: remote, method: http_method, uid: entry.uid, first_name: entry.first_name, last_name: entry.last_name, email: entry.email, } } end def classes extra_class = params['result-link-class'].presence || 'result-link-default' "result-link #{extra_class}" end def item_url url_param.present? ? url_and_person_params : '#' end def remote url_param.present? end def http_method params['result-link-http-method'] || :get end def url_param params["result-link-url"] end def url_and_person_params connector = url_param.include?("?") ? '&' : '?' "#{url_param}#{connector}#{person_params.to_query}" end def person_params { uid: entry.uid, first_name: entry.first_name, last_name: entry.last_name, } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ucb_rails-0.0.2 | app/helpers/ucb_rails/renderer/ldap_person_search_result_link.rb |