forked from decidim/decidim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
86 additions
and
3 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
decidim-admin/app/commands/decidim/admin/create_share_token.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# frozen_string_literal: true | ||
|
||
module Decidim | ||
module Admin | ||
class CreateShareToken < Decidim::Command | ||
def initialize(form, share_token) | ||
@form = form | ||
@share_token = share_token | ||
end | ||
|
||
def call | ||
return broadcast(:invalid) if form.invalid? | ||
|
||
ShareToken.create!(component: share_token, token: form.token) | ||
broadcast(:ok) | ||
end | ||
|
||
private | ||
|
||
attr_reader :form, :share_token | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<div class="form__wrapper"> | ||
<div class="card pt-4"> | ||
<div class="row column"> | ||
<%= form.text_field :token, aria: { label: :token }, style: "text-transform: uppercase" %> | ||
</div> | ||
<div class="row column"> | ||
<%= form.datetime_field :expires_at, aria: { label: :expires_at } %> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<% add_decidim_page_title(t(".title")) %> | ||
<div class="item_show__header"> | ||
<h1 class="item_show__header-title"> | ||
<%= t ".title", component_name: translated_attribute(component.name) %> | ||
<a class="button button__sm button__secondary" href="<%= share_tokens_path(component) %>"><%= t("share_tokens.index.back_to_share_tokens", scope: "decidim.admin") %></a> | ||
</h1> | ||
</div> | ||
<div class="item__edit-form"> | ||
<%= decidim_form_for(@form, url: share_tokens_path(component), html: { class: "form-defaults form ew_component_share_token" }) do |f| %> | ||
<div class="card"> | ||
<div class="card-section"> | ||
<%= render partial: "form", object: f %> | ||
</div> | ||
</div> | ||
<div class="item__edit-sticky"> | ||
<div class="item__edit-sticky-container"> | ||
<%= f.submit t(".create"), class: "button button__sm button__secondary" %> | ||
</div> | ||
</div> | ||
<% end %> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters