Sha256: a95fa03d800f18b7361e7062547d71c998b5ff6c35e1bac84608a1f90731111e

Contents?: true

Size: 1.01 KB

Versions: 22

Compression:

Stored size: 1.01 KB

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.close_me = l(<<-JS)
    function() {
      // assume we're embedded in a window
      this.netzkeGetParentComponent().close();
    }
    JS
  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

22 entries across 22 versions & 1 rubygems

Version Path
marty-2.4.7 app/components/marty/new_posting_form.rb
marty-2.4.6 app/components/marty/new_posting_form.rb
marty-2.4.5 app/components/marty/new_posting_form.rb
marty-2.4.4 app/components/marty/new_posting_form.rb
marty-2.4.3 app/components/marty/new_posting_form.rb
marty-2.4.2 app/components/marty/new_posting_form.rb
marty-2.4.1 app/components/marty/new_posting_form.rb
marty-2.4.0 app/components/marty/new_posting_form.rb
marty-2.3.15 app/components/marty/new_posting_form.rb
marty-2.3.14 app/components/marty/new_posting_form.rb
marty-2.3.13 app/components/marty/new_posting_form.rb
marty-2.3.12 app/components/marty/new_posting_form.rb
marty-2.3.11 app/components/marty/new_posting_form.rb
marty-2.3.10 app/components/marty/new_posting_form.rb
marty-2.3.9 app/components/marty/new_posting_form.rb
marty-2.3.8 app/components/marty/new_posting_form.rb
marty-2.3.7 app/components/marty/new_posting_form.rb
marty-2.3.5 app/components/marty/new_posting_form.rb
marty-2.3.4 app/components/marty/new_posting_form.rb
marty-2.3.2 app/components/marty/new_posting_form.rb