initial commit

This commit is contained in:
Sam 2017-02-02 17:05:33 -05:00
commit c68a6652ec
6 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import showModal from 'discourse/lib/show-modal';
export default {
shouldRender(args, component) {
return component.currentUser && component.currentUser.get('staff');
},
actions: {
assign(){
showModal("assign-user");
}
}
};

View File

@ -0,0 +1,2 @@
//function initializeWithApi() {
//};

View File

@ -0,0 +1,7 @@
{{#d-modal-body title="discourse_assigns.assign_modal.title" class="assign"}}
hi there
{{/d-modal-body}}
<div class="modal-footer">
I am the footer
</div>

View File

@ -0,0 +1,5 @@
{{d-button class="assign"
icon="user-plus"
action="assign"
label="discourse_assigns.assign.title"
title="discourse_assigns.assign.help"}}

View File

@ -0,0 +1,6 @@
en:
js:
discourse_assigns:
assign:
title: "Assign"
help: "Assign Topic to User"

25
plugin.rb Normal file
View File

@ -0,0 +1,25 @@
# name: discourse-assigns
# about: Assign users to topics
# version: 0.1
# authors: Sam Saffron
after_initialize do
sql =<<SQL
CREATE TABLE IF NOT EXISTS assigned_users(
id SERIAL NOT NULL PRIMARY KEY,
topic_id integer NOT NULL,
assigned_to_id integer NOT NULL,
assigned_by_id integer,
created_at timestamp without time zone
)
SQL
User.exec_sql(sql)
class ::AssignedUser < ActiveRecord::Base
belongs_to :topic
belongs_to :assigned_to, class_name: 'User'
belongs_to :assigned_by, class_name: 'User'
end
end