initial commit
This commit is contained in:
commit
c68a6652ec
|
@ -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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -0,0 +1,2 @@
|
||||||
|
//function initializeWithApi() {
|
||||||
|
//};
|
|
@ -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>
|
|
@ -0,0 +1,5 @@
|
||||||
|
{{d-button class="assign"
|
||||||
|
icon="user-plus"
|
||||||
|
action="assign"
|
||||||
|
label="discourse_assigns.assign.title"
|
||||||
|
title="discourse_assigns.assign.help"}}
|
|
@ -0,0 +1,6 @@
|
||||||
|
en:
|
||||||
|
js:
|
||||||
|
discourse_assigns:
|
||||||
|
assign:
|
||||||
|
title: "Assign"
|
||||||
|
help: "Assign Topic to User"
|
|
@ -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
|
Loading…
Reference in New Issue