Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
rendezvous
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
VeNtura
rendezvous
Commits
c2bc335f
Commit
c2bc335f
authored
Mar 13, 2014
by
tady
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
stock controller
parent
2d068d29
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
19 additions
and
3 deletions
+19
-3
app/controllers/home_controller.rb
+1
-1
app/decorators/tag_decorator.rb
+1
-0
app/models/tag.rb
+7
-0
app/views/stock/show.html.erb
+0
-2
app/views/stock/show.html.slim
+10
-0
No files found.
app/controllers/home_controller.rb
View file @
c2bc335f
...
...
@@ -3,7 +3,7 @@ class HomeController < ApplicationController
def
top
if
user_signed_in?
redirect_to
posts
_path
,
status:
301
redirect_to
flow
_path
,
status:
301
else
render
template:
'home/login'
end
...
...
app/decorators/tag_decorator.rb
View file @
c2bc335f
...
...
@@ -23,6 +23,7 @@ class TagDecorator < Draper::Decorator
# tagをtree viewで表示する
def
tree_view_node
_html
=
''
_html
+=
%Q{
<a href="
#{
self
.
show_path
}
" data-name="
#{
model
.
name
}
">
#{
model
.
name
}
<span class="badge">
#{
model
.
posts
.
count
}
</span>
...
...
app/models/tag.rb
View file @
c2bc335f
...
...
@@ -10,6 +10,13 @@ class Tag < ActiveRecord::Base
default_scope
{
order
(
:updated_at
=>
:desc
)
}
scope
:posts_exist
,
lambda
{
select
(
'tags.*, count(posts.id) as posts_count'
).
joins
(
:posts
).
group
(
'tags.id'
).
having
(
'posts_count > 0'
)
}
# 自分のタグに紐づくPostをすべて`other_tag`へ移動する
def
move_all_posts_to!
(
other_tag
)
self
.
posts
.
each
do
|
_post
|
...
...
app/views/stock/show.html.erb
deleted
100644 → 0
View file @
2d068d29
<h1>
Stock#show
</h1>
<p>
Find me in app/views/stock/show.html.erb
</p>
app/views/stock/show.html.slim
0 → 100644
View file @
c2bc335f
/! view:stock/show
.row
#sidebar
.col-xs-6.col-md-4
role
=
"navigation"
#tab-tree
.tab-pane
-
cache
(
'tag-tree'
,
:expires_in
=>
1
.
hour
)
do
.list-group
=
Tag
.
posts_exist
.
decorate
.
tree_view
.col-xs-12.col-sm-6.col-md-8
#list_post
p
#posts-placeholder
style
=
"color:#aaa;font-size:30px"
<
--
Select
a
post
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment