Add timestamps to Topic. Add fields on topic list.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
class TopicsController < ApplicationController
|
class TopicsController < ApplicationController
|
||||||
|
# include CommentableActions
|
||||||
|
|
||||||
before_action :set_community
|
before_action :set_community
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,10 @@
|
|||||||
<% topics.each do |topic| %>
|
<% topics.each do |topic| %>
|
||||||
<div id="<%= dom_id(topic) %>">
|
<div id="<%= dom_id(topic) %>">
|
||||||
<%= link_to topic.title, community_topic_path(@community, topic) %>
|
<%= link_to topic.title, community_topic_path(@community, topic) %>
|
||||||
|
<br>
|
||||||
|
<%= topic.author.name %>
|
||||||
|
<br>
|
||||||
|
<%= I18n.l topic.created_at %>
|
||||||
<% if topic.author == current_user %>
|
<% if topic.author == current_user %>
|
||||||
<%= link_to t("topic.edit"), edit_community_topic_path(@community.id, topic), class: 'button expanded' %>
|
<%= link_to t("topic.edit"), edit_community_topic_path(@community.id, topic), class: 'button expanded' %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<div class="topic-new row">
|
<div class="topic-new row">
|
||||||
<div class="small-12 medium-9 column">
|
<div class="small-12 medium-9 column">
|
||||||
|
<%= render "shared/back_link" %>
|
||||||
<h1><%= t("topic.create") %></h1>
|
<h1><%= t("topic.create") %></h1>
|
||||||
|
|
||||||
<%= render '/topics/form' %>
|
<%= render '/topics/form' %>
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ class CreateTopics < ActiveRecord::Migration
|
|||||||
t.string :title, null: false
|
t.string :title, null: false
|
||||||
t.integer :author_id
|
t.integer :author_id
|
||||||
t.references :community, index: true
|
t.references :community, index: true
|
||||||
|
t.timestamps null: false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -891,9 +891,11 @@ ActiveRecord::Schema.define(version: 20170807082243) do
|
|||||||
add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree
|
add_index "tags", ["spending_proposals_count"], name: "index_tags_on_spending_proposals_count", using: :btree
|
||||||
|
|
||||||
create_table "topics", force: :cascade do |t|
|
create_table "topics", force: :cascade do |t|
|
||||||
t.string "title", null: false
|
t.string "title", null: false
|
||||||
t.integer "author_id"
|
t.integer "author_id"
|
||||||
t.integer "community_id"
|
t.integer "community_id"
|
||||||
|
t.datetime "created_at", null: false
|
||||||
|
t.datetime "updated_at", null: false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "topics", ["community_id"], name: "index_topics_on_community_id", using: :btree
|
add_index "topics", ["community_id"], name: "index_topics_on_community_id", using: :btree
|
||||||
|
|||||||
Reference in New Issue
Block a user