Commit 55d27387 by tady

fullcalendar.js tag page

parent 61c45fc3
# Desc
# カレンダーにイベントを表示する
# `.js-calendar`クラスのついた要素
# Usage:
# Example:
$ ->
$('.js-calendar').each ->
$this = $(@)
$this.fullCalendar
events: $this.data('eventsUrl') + '.json'
class TagsController < ApplicationController class TagsController < ApplicationController
before_action :set_tag, only: [:show, :edit, :update, :destroy, :merge_to, :move_to] before_action :set_tag, only: [:show, :edit, :update, :destroy, :merge_to, :move_to, :events]
def index def index
end end
...@@ -14,6 +14,9 @@ class TagsController < ApplicationController ...@@ -14,6 +14,9 @@ class TagsController < ApplicationController
def edit def edit
end end
def events
end
def create def create
@tag = Tag.new(tag_params) @tag = Tag.new(tag_params)
......
...@@ -20,6 +20,10 @@ class TagDecorator < Draper::Decorator ...@@ -20,6 +20,10 @@ class TagDecorator < Draper::Decorator
h.edit_tag_path(name: h.url_encode(model.name)) h.edit_tag_path(name: h.url_encode(model.name))
end end
def event_tag_path
h.event_tag_path(name: h.url_encode(model.name))
end
# tagをtree viewで表示する # tagをtree viewで表示する
def tree_view_node def tree_view_node
_html = '' _html = ''
......
...@@ -6,6 +6,8 @@ html lang="ja" ...@@ -6,6 +6,8 @@ html lang="ja"
meta content="width=device-width, initial-scale=1.0" name="viewport" / meta content="width=device-width, initial-scale=1.0" name="viewport" /
link href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet" / link href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap.min.css" rel="stylesheet" /
link href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css" rel="stylesheet" / link href="//netdna.bootstrapcdn.com/bootstrap/3.0.2/css/bootstrap-theme.min.css" rel="stylesheet" /
link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/1.6.4/fullcalendar.css" rel="stylesheet" /
link href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/1.6.4/fullcalendar.print.css" rel="stylesheet" /
= stylesheet_link_tag "application", media: "all" = stylesheet_link_tag "application", media: "all"
= render_style = render_style
= csrf_meta_tags = csrf_meta_tags
...@@ -21,6 +23,7 @@ html lang="ja" ...@@ -21,6 +23,7 @@ html lang="ja"
script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"
script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js" script src="//netdna.bootstrapcdn.com/bootstrap/3.0.2/js/bootstrap.min.js"
script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.5.1/moment.min.js" script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.5.1/moment.min.js"
script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/1.6.4/fullcalendar.min.js"
javascript: javascript:
window.RV = window.RV || {}; window.RV = window.RV || {};
window.RV.AllTags = JSON.parse('#{raw Tag.all.pluck(:name).to_json}'); window.RV.AllTags = JSON.parse('#{raw Tag.all.pluck(:name).to_json}');
......
...@@ -5,12 +5,8 @@ ...@@ -5,12 +5,8 @@
| Stock | Stock
small - 保存・蓄積された記事 small - 保存・蓄積された記事
#sidebar.col-xs-6.col-md-4 role="navigation" #sidebar.col-xs-12 role="navigation"
#tab-tree.tab-pane #tab-tree.tab-pane
- cache('tag-tree', :expires_in => 1.hour) do - cache('tag-tree', :expires_in => 1.hour) do
.list-group .list-group
= Tag.posts_exist.decorate.tree_view = 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" &lt;-- Select a post...
json.array!(@tag.posts) do |post|
json.extract! post, :title
json.url post_url(post)
json.start post.created_at
end
...@@ -17,9 +17,18 @@ ...@@ -17,9 +17,18 @@
a data-target="#modal-merge" data-toggle="modal" href="#" Merge to... a data-target="#modal-merge" data-toggle="modal" href="#" Merge to...
li li
a data-target="#modal-moveUnder" data-toggle="modal" href="#" Move this tag under... a data-target="#modal-moveUnder" data-toggle="modal" href="#" Move this tag under...
.row
.col-xs-8 .col-xs-8
.panel.panel-default .panel.panel-default
.panel-heading .panel-heading
|#{@tag.name}」カレンダー
.panel-body
.js-calendar data-events-url=@tag.event_tag_path
.panel.panel-default
.panel-heading
|#{@tag.name}」とは |#{@tag.name}」とは
.panel-body .panel-body
- if @tag.body.present? - if @tag.body.present?
......
...@@ -2,6 +2,7 @@ Rendezvous::Application.routes.draw do ...@@ -2,6 +2,7 @@ Rendezvous::Application.routes.draw do
post 'apis/markdown_preview' post 'apis/markdown_preview'
post 'apis/file_receiver' post 'apis/file_receiver'
get 'tags/:name/events' => 'tags#events', as: 'event_tag'
root 'welcome#top', as: 'root' root 'welcome#top', as: 'root'
......
...@@ -6,4 +6,8 @@ describe TagsController do ...@@ -6,4 +6,8 @@ describe TagsController do
pending '...' pending '...'
end end
describe "GET 'events'" do
pending '...'
end
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment