Sha256: 5dbfab6b33b5cf851afe8e4766581013f4051c195c17bebb22a2d8baadaf71d9

Contents?: true

Size: 1.01 KB

Versions: 28

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

  js_configure do |c|
    c.close_me = <<-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    = :time_add
  end

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

  endpoint :netzke_submit do |params, this|
    res = super(params, this)
    this.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

28 entries across 28 versions & 1 rubygems

Version Path
marty-0.5.41 app/components/marty/new_posting_form.rb
marty-0.5.40 app/components/marty/new_posting_form.rb
marty-0.5.39 app/components/marty/new_posting_form.rb
marty-0.5.38 app/components/marty/new_posting_form.rb
marty-0.5.36 app/components/marty/new_posting_form.rb
marty-0.5.35 app/components/marty/new_posting_form.rb
marty-0.5.34 app/components/marty/new_posting_form.rb
marty-0.5.33 app/components/marty/new_posting_form.rb
marty-0.5.32 app/components/marty/new_posting_form.rb
marty-0.5.31 app/components/marty/new_posting_form.rb
marty-0.5.30 app/components/marty/new_posting_form.rb
marty-0.5.29 app/components/marty/new_posting_form.rb
marty-0.5.28 app/components/marty/new_posting_form.rb
marty-0.5.27 app/components/marty/new_posting_form.rb
marty-0.5.26 app/components/marty/new_posting_form.rb
marty-0.5.25 app/components/marty/new_posting_form.rb
marty-0.5.24 app/components/marty/new_posting_form.rb
marty-0.5.23 app/components/marty/new_posting_form.rb
marty-0.5.21 app/components/marty/new_posting_form.rb
marty-0.5.20 app/components/marty/new_posting_form.rb