diff --git a/app/assets/stylesheets/style.css.scss b/app/assets/stylesheets/style.css.scss index 542396c..312f599 100644 --- a/app/assets/stylesheets/style.css.scss +++ b/app/assets/stylesheets/style.css.scss @@ -984,4 +984,13 @@ nav.pagination { color: #000; display: inline-block; padding: 2px 5px; +} + +.label { + background: #d40; + padding: 0.1em 0.2em; + border-radius: 0.2em; + color: #b20; + border: 1px solid #B20; + text-shadow: -1px -1px #e50, 1px 1px #a10; } \ No newline at end of file diff --git a/app/models/forum.rb b/app/models/forum.rb index 4d8b750..48a19b7 100644 --- a/app/models/forum.rb +++ b/app/models/forum.rb @@ -3,6 +3,7 @@ class Forum < ActiveRecord::Base has_many :forumthreads belongs_to :role_read, class_name: "Role", foreign_key: "role_read_id" belongs_to :role_write, class_name: "Role", foreign_key: "role_write_id" + has_and_belongs_to_many :labels def to_s name diff --git a/app/models/forumthread.rb b/app/models/forumthread.rb index 0d7a5d4..b6db0b3 100644 --- a/app/models/forumthread.rb +++ b/app/models/forumthread.rb @@ -6,6 +6,7 @@ class Forumthread < ActiveRecord::Base belongs_to :forum belongs_to :user_author, class_name: "User", foreign_key: "user_author_id" belongs_to :user_editor, class_name: "User", foreign_key: "user_editor_id" + belongs_to :label has_many :threadreplies validates_presence_of :title, :author, :forum diff --git a/app/models/label.rb b/app/models/label.rb new file mode 100644 index 0000000..0bcc7b9 --- /dev/null +++ b/app/models/label.rb @@ -0,0 +1,11 @@ +class Label < ActiveRecord::Base + validates_presence_of :name + belongs_to :role + has_and_belongs_to_many :forums + has_many :forumthreads + + def to_s + name.upcase + end + +end \ No newline at end of file diff --git a/app/views/forumthreads/show.html.erb b/app/views/forumthreads/show.html.erb index 16fa7dc..10cfeb6 100644 --- a/app/views/forumthreads/show.html.erb +++ b/app/views/forumthreads/show.html.erb @@ -1,5 +1,5 @@ <%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → <%=truncate(@thread.title, length: 60, omission: " …") %> -