Sha256: 3c55fa327f11811515c1af327cbd989c3ef8af76b6bfab89f94e00d66213dbe5
Contents?: true
Size: 1.33 KB
Versions: 3
Compression:
Stored size: 1.33 KB
Contents
include_set Abstract::AccountDropdown def ok_to_read true end def ok_to_update left_id == Auth.current_id end def ok_to_create left_id == Auth.current_id end def ensure_roles self.content = Auth.current_roles.to_pointer_content if content.blank? end event :validate_role_enabling, :validate, on: :save do illegal_roles = item_names - Auth.current_roles return if illegal_roles.empty? errors.add :content, "illegal roles: #{illegal_roles.to_sentence}" # LOCALIZE end event :clear_roles_cache, :prepare_to_store, before: :store_in_session do clear_roles Auth.update_always_cache nil end format :html do # permission change compared to super view :edit_inline, perms: :none, unknown: true, cache: :never, wrap: :slot do super() end def input_type :checkbox end def edit_success { reload: true } end def hidden_form_tags _action, opts "#{super} #{hidden_tags card: { type_id: SessionID }}" end def checkbox_input card.ensure_roles wrap_with :div, class: "pointer-checkbox-list" do account_dropdown(&method(:role_item_checkbox)) end end def role_item_checkbox role_name haml :role_checkbox, id: "pointer-checkbox-#{role_name.to_name.key}", checked: card.item_names.include?(role_name), option_name: role_name end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
card-mod-layout-0.14.2 | set/right/enabled_roles.rb |
card-mod-layout-0.14.1 | set/right/enabled_roles.rb |
card-mod-layout-0.14.0 | set/right/enabled_roles.rb |