Sha256: 09519df1f5332ceb29011456f0dfc5afa2e1866ea9d34e64b2d3e3505d2357b4

Contents?: true

Size: 920 Bytes

Versions: 5

Compression:

Stored size: 920 Bytes

Contents

class Marty::NewPostingForm < Marty::Form
  extend ::Marty::Permissions

  # override this to set permissions for posting types
  has_marty_permissions read: :any

  client_class do |c|
    c.include :new_posting_form
  end

  action :apply do |a|
    a.text     = I18n.t("create_posting")
    a.tooltip  = I18n.t("create_posting")
    a.icon_cls = 'fa fa-clock glyph'
  end

  ######################################################################

  endpoint :submit do |params|
    res = super(params)
    client.close_me
    res
  end

  def configure(c)
    super

    c.model = "Marty::Posting"
    c.items = [
               {
                 name: :posting_type__name,
                 scope: lambda { |r|
                   r.where(name: Marty::NewPostingForm.can_perform_actions)
                 },
               },
               :comment,
              ]
  end
end

NewPostingForm = Marty::NewPostingForm

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
marty-2.5.2 app/components/marty/new_posting_form.rb
marty-2.5.1 app/components/marty/new_posting_form.rb
marty-2.5.0 app/components/marty/new_posting_form.rb
marty-2.4.9 app/components/marty/new_posting_form.rb
marty-2.4.8 app/components/marty/new_posting_form.rb