tkh_content 0.9.7 → 0.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/CHANGELOG.md +5 -0
 - data/app/controllers/blog_controller.rb +7 -92
 - data/app/models/tag.rb +6 -0
 - data/app/views/blog/_admin_context_menu.html.erb +13 -0
 - data/app/views/blog/_all_tags_list.html.erb +10 -0
 - data/app/views/blog/_individual_tag.html.erb +1 -0
 - data/app/views/blog/by_tag.html.erb +23 -0
 - data/app/views/blog/index.html.erb +5 -1
 - data/app/views/pages/_blog_post_meta.html.erb +13 -7
 - data/app/views/pages/_form.html.erb +8 -7
 - data/app/views/pages/show.html.erb +2 -0
 - data/config/routes.rb +6 -6
 - data/lib/generators/tkh_content/create_or_update_files/templates/blog.html.erb +9 -9
 - data/lib/tkh_content/version.rb +1 -1
 - metadata +6 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 5aa776dd50acb59c951e8fd0506a2af67d60aa50
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 3ecdb0062469aae86f29403e5fa710a8f36a8c5c
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ccff788f856910f0b2b1b6478d5495917a0e72c9c082afd69c3a94cdd734dad97e6d7896a3ca43c26395e208635920c1bf3de3887017e179e5f43d61edb5a1c9
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f3edf90b3b14d5b35314dd59119b7619236c320dded4c8416308f1bc19fa31adec1e3aad8acd2f9f0f8b317c124b727b1f4ebc83cdbd14b4f0231b5366e3f90c
         
     | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| 
         @@ -1,102 +1,17 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            class BlogController < ApplicationController
         
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
       3 
3 
     | 
    
         
             
              def index
         
     | 
| 
       4 
     | 
    
         
            -
                 
     | 
| 
       5 
     | 
    
         
            -
                  @posts = Page.for_blog.published.order('published_at desc').paginate(:page => params[:page], :per_page => 20)
         
     | 
| 
       6 
     | 
    
         
            -
                else
         
     | 
| 
       7 
     | 
    
         
            -
                  @posts = Page.for_blog.published.tagged_with(params[:tag]).order('published_at desc').paginate(:page => params[:page], :per_page => 20)
         
     | 
| 
       8 
     | 
    
         
            -
                end
         
     | 
| 
      
 4 
     | 
    
         
            +
                @posts = Page.for_blog.published.order('published_at desc').paginate(:page => params[:page], :per_page => 20)
         
     | 
| 
       9 
5 
     | 
    
         
             
                respond_to do |format|
         
     | 
| 
       10 
6 
     | 
    
         
             
                  format.html { render :layout => 'blog' }
         
     | 
| 
       11 
7 
     | 
    
         
             
                  format.atom
         
     | 
| 
       12 
8 
     | 
    
         
             
                end
         
     | 
| 
       13 
9 
     | 
    
         
             
              end
         
     | 
| 
       14 
     | 
    
         
            -
              
         
     | 
| 
       15 
     | 
    
         
            -
              # This is temporary and only to complete the import to SA's site.
         
     | 
| 
       16 
     | 
    
         
            -
              def update_data
         
     | 
| 
       17 
     | 
    
         
            -
                
         
     | 
| 
       18 
     | 
    
         
            -
                @count = 0
         
     | 
| 
       19 
     | 
    
         
            -
                @pages = Array.new
         
     | 
| 
       20 
     | 
    
         
            -
                
         
     | 
| 
       21 
     | 
    
         
            -
                Page.all.each do |page|
         
     | 
| 
       22 
     | 
    
         
            -
                  # determine whether page contains path
         
     | 
| 
       23 
     | 
    
         
            -
                  if page.body.match /src="\/system\/photos\/.*\.jpg/
         
     | 
| 
       24 
     | 
    
         
            -
                    # extract string to be changed
         
     | 
| 
       25 
     | 
    
         
            -
                    # match_data = page.body.match /src="\/system\/photos\/.*\.jpg/
         
     | 
| 
       26 
     | 
    
         
            -
                    # # extract an image name with jpg extension in the blog/2006 section
         
     | 
| 
       27 
     | 
    
         
            -
                    # extracted_image = match_data.to_s.sub("src=\"/images/photos/", '')
         
     | 
| 
       28 
     | 
    
         
            -
                    # # find the corresponding illustration
         
     | 
| 
       29 
     | 
    
         
            -
                    # illustration = Illustration.find_by_name(extracted_image)
         
     | 
| 
       30 
     | 
    
         
            -
                    # if illustration
         
     | 
| 
       31 
     | 
    
         
            -
                    #   # change the image path
         
     | 
| 
       32 
     | 
    
         
            -
                    #   page.body = page.body.sub("/images/blog/2007/", "/system/images/illustration/#{illustration.id}/large_")
         
     | 
| 
       33 
     | 
    
         
            -
                    #   # save the page with new path
         
     | 
| 
       34 
     | 
    
         
            -
                    #   page.save
         
     | 
| 
       35 
     | 
    
         
            -
                    # end  
         
     | 
| 
       36 
     | 
    
         
            -
                    @count += 1
         
     | 
| 
       37 
     | 
    
         
            -
                    @pages << page
         
     | 
| 
       38 
     | 
    
         
            -
                    
         
     | 
| 
       39 
     | 
    
         
            -
                  end
         
     | 
| 
       40 
     | 
    
         
            -
                end
         
     | 
| 
       41 
     | 
    
         
            -
                
         
     | 
| 
       42 
     | 
    
         
            -
                # @list_of_files = Array.new
         
     | 
| 
       43 
     | 
    
         
            -
                
         
     | 
| 
       44 
     | 
    
         
            -
                # @count = 0
         
     | 
| 
       45 
     | 
    
         
            -
                
         
     | 
| 
       46 
     | 
    
         
            -
                # Illustration.all.each do |illustration|
         
     | 
| 
       47 
     | 
    
         
            -
                #   
         
     | 
| 
       48 
     | 
    
         
            -
                #   if illustration.name == 'No name given'
         
     | 
| 
       49 
     | 
    
         
            -
                #     
         
     | 
| 
       50 
     | 
    
         
            -
                #     illustration.destroy
         
     | 
| 
       51 
     | 
    
         
            -
                #     @count += 1 
         
     | 
| 
       52 
     | 
    
         
            -
                #     
         
     | 
| 
       53 
     | 
    
         
            -
                #   end
         
     | 
| 
       54 
     | 
    
         
            -
                #   
         
     | 
| 
       55 
     | 
    
         
            -
                #   # # extract an image name with jpg extension in the blog/2006 section
         
     | 
| 
       56 
     | 
    
         
            -
                #   # extracted_image = page.body.match(/src="\/images\/blog\/2006\/.*\.jpg/).to_s.sub("src=\"/images/blog/2006/", '')
         
     | 
| 
       57 
     | 
    
         
            -
                #   # 
         
     | 
| 
       58 
     | 
    
         
            -
                #   # if extracted_image
         
     | 
| 
       59 
     | 
    
         
            -
                #   #   
         
     | 
| 
       60 
     | 
    
         
            -
                #   #    # find the corresponding illustration
         
     | 
| 
       61 
     | 
    
         
            -
                #   #     @illustration = Illustration.find_by_image(File.basename("/Users/swamiatma/Documents/railsapps/aya/public/images/blog/2006/#{extracted_image}"))
         
     | 
| 
       62 
     | 
    
         
            -
                #   #     
         
     | 
| 
       63 
     | 
    
         
            -
                #   #     if @illustration
         
     | 
| 
       64 
     | 
    
         
            -
                #   #       # change the path of the image
         
     | 
| 
       65 
     | 
    
         
            -
                #   #       page.body = page.body.sub("/images/blog/2006/", "/system/images/illustration/#{@illustration.id}/large_")
         
     | 
| 
       66 
     | 
    
         
            -
                #   #       # save the page with new path
         
     | 
| 
       67 
     | 
    
         
            -
                #   #       page.save
         
     | 
| 
       68 
     | 
    
         
            -
                #   #     
         
     | 
| 
       69 
     | 
    
         
            -
                #   #       count += 1
         
     | 
| 
       70 
     | 
    
         
            -
                #   #       extracted_image = nil
         
     | 
| 
       71 
     | 
    
         
            -
                #   #     end
         
     | 
| 
       72 
     | 
    
         
            -
                #   #   
         
     | 
| 
       73 
     | 
    
         
            -
                #   # end
         
     | 
| 
       74 
     | 
    
         
            -
                #  
         
     | 
| 
       75 
     | 
    
         
            -
                # end
         
     | 
| 
       76 
     | 
    
         
            -
                
         
     | 
| 
       77 
     | 
    
         
            -
                # # take a blog post as an example
         
     | 
| 
       78 
     | 
    
         
            -
                # @page = Page.find(9)
         
     | 
| 
       79 
10 
     | 
    
         | 
| 
       80 
     | 
    
         
            -
             
     | 
| 
       81 
     | 
    
         
            -
                 
     | 
| 
       82 
     | 
    
         
            -
                 
     | 
| 
       83 
     | 
    
         
            -
                 
     | 
| 
       84 
     | 
    
         
            -
                #     
         
     | 
| 
       85 
     | 
    
         
            -
                # Dir["/Users/swamiatma/Documents/railsapps/aya/public/images/photos/*.*"].each do |file|
         
     | 
| 
       86 
     | 
    
         
            -
                #   
         
     | 
| 
       87 
     | 
    
         
            -
                #   illustration = Illustration.new
         
     | 
| 
       88 
     | 
    
         
            -
                #   illustration.image = File.open(file)
         
     | 
| 
       89 
     | 
    
         
            -
                #   illustration.name = "photos-#{File.basename(file)}"
         
     | 
| 
       90 
     | 
    
         
            -
                #   illustration.save
         
     | 
| 
       91 
     | 
    
         
            -
                #   
         
     | 
| 
       92 
     | 
    
         
            -
                #   count += 1
         
     | 
| 
       93 
     | 
    
         
            -
                #   
         
     | 
| 
       94 
     | 
    
         
            -
                # end
         
     | 
| 
       95 
     | 
    
         
            -
                # 
         
     | 
| 
       96 
     | 
    
         
            -
                # 
         
     | 
| 
       97 
     | 
    
         
            -
                # redirect_to illustrations_path, notice: "#{count} new illustrations should be uploaded"
         
     | 
| 
       98 
     | 
    
         
            -
                
         
     | 
| 
       99 
     | 
    
         
            -
                
         
     | 
| 
      
 11 
     | 
    
         
            +
              def by_tag
         
     | 
| 
      
 12 
     | 
    
         
            +
                @tag = Tag.where('name = ?', params[:id]).first
         
     | 
| 
      
 13 
     | 
    
         
            +
                @posts = @tag.pages.order('published_at desc').paginate(:page => params[:page], :per_page => 20)
         
     | 
| 
      
 14 
     | 
    
         
            +
                render :layout => 'blog'
         
     | 
| 
       100 
15 
     | 
    
         
             
              end
         
     | 
| 
       101 
     | 
    
         
            -
             
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
       102 
17 
     | 
    
         
             
            end
         
     | 
    
        data/app/models/tag.rb
    CHANGED
    
    | 
         @@ -18,4 +18,10 @@ class Tag < ActiveRecord::Base 
     | 
|
| 
       18 
18 
     | 
    
         
             
                name ? "#{id}-#{name.to_url}" : id
         
     | 
| 
       19 
19 
     | 
    
         
             
              end
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
      
 21 
     | 
    
         
            +
              def self.with_taggings
         
     | 
| 
      
 22 
     | 
    
         
            +
                taggings = Tagging.select("DISTINCT tag_id")
         
     | 
| 
      
 23 
     | 
    
         
            +
                ids = taggings.map { |tagging| tagging.tag_id }
         
     | 
| 
      
 24 
     | 
    
         
            +
                tags = Tag.order('name').find(ids)
         
     | 
| 
      
 25 
     | 
    
         
            +
              end
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       21 
27 
     | 
    
         
             
            end
         
     | 
| 
         @@ -0,0 +1,13 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <% if administrator? %>
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
              <% content_for :admin_context_menu do %>
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
                <h2><%= t('admin_section') %></h2>
         
     | 
| 
      
 6 
     | 
    
         
            +
                <ul class="list-group">
         
     | 
| 
      
 7 
     | 
    
         
            +
                  <li class="list-group-item"><%= link_to t('admin_panel'), pages_path %></li>
         
     | 
| 
      
 8 
     | 
    
         
            +
                  <%= content_tag :li, link_to( "#{t('activerecord.models.comments').capitalize} <span class='badge'>#{Comment.pending.count}</span>".html_safe, pending_comments_path ), class: 'list-group-item' if Comment.pending.count > 0 %>
         
     | 
| 
      
 9 
     | 
    
         
            +
                </ul>
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
              <% end -%>
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            <% end -%>
         
     | 
| 
         @@ -0,0 +1,10 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <% content_for :all_tags_list do %>
         
     | 
| 
      
 2 
     | 
    
         
            +
              <h2>étiquettes</h2>
         
     | 
| 
      
 3 
     | 
    
         
            +
              <% if Tag.count > 0 %>
         
     | 
| 
      
 4 
     | 
    
         
            +
                <p class="all-tags-list">
         
     | 
| 
      
 5 
     | 
    
         
            +
                  <%= render :partial => 'blog/individual_tag', collection: Tag.with_taggings, as: :tag %>
         
     | 
| 
      
 6 
     | 
    
         
            +
                </p>
         
     | 
| 
      
 7 
     | 
    
         
            +
              <% else %>
         
     | 
| 
      
 8 
     | 
    
         
            +
                <p>There are currently no tags to display</p>
         
     | 
| 
      
 9 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 10 
     | 
    
         
            +
            <% end %>
         
     | 
| 
         @@ -0,0 +1 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <%= content_tag :span, link_to(tag.name, blog_by_tag_path(tag.name)), class: 'individual-tag' %>
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            <% content_for :meta_title, Setting.first.try(:company_name) %>
         
     | 
| 
      
 2 
     | 
    
         
            +
            <% content_for :meta_description, "Blog posts with the '#{@tag.name}' tag." %>
         
     | 
| 
      
 3 
     | 
    
         
            +
            <% content_for :canonical_link, link_to('', blog_path, rel: 'canonical') %>
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            <div class="panel panel-info">
         
     | 
| 
      
 6 
     | 
    
         
            +
              <div class="panel-heading">
         
     | 
| 
      
 7 
     | 
    
         
            +
                <h3 class="panel-title"><%= @tag.name %></h3>
         
     | 
| 
      
 8 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 9 
     | 
    
         
            +
              <div class="panel-body">
         
     | 
| 
      
 10 
     | 
    
         
            +
                Liste des articles avec cette étiquette
         
     | 
| 
      
 11 
     | 
    
         
            +
              </div>
         
     | 
| 
      
 12 
     | 
    
         
            +
            </div>
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            <% for post in @posts %>
         
     | 
| 
      
 15 
     | 
    
         
            +
              <%= render '/pages/individual_blog_post_in_list', post: post %>
         
     | 
| 
      
 16 
     | 
    
         
            +
            <% end %>
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
            <%= will_paginate @posts %>
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            <%= render 'all_tags_list' %>
         
     | 
| 
      
 21 
     | 
    
         
            +
            <%= render( 'admin_context_menu', page: @page) %>
         
     | 
| 
      
 22 
     | 
    
         
            +
            <%# partial in tkh_menus gem or has to be added in host app %>
         
     | 
| 
      
 23 
     | 
    
         
            +
            <%= render './shared/menus' %>
         
     | 
| 
         @@ -7,5 +7,9 @@ 
     | 
|
| 
       7 
7 
     | 
    
         
             
            	<%= render '/pages/individual_blog_post_in_list', post: post %>
         
     | 
| 
       8 
8 
     | 
    
         
             
            <% end %>
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
10 
     | 
    
         
             
            <%= will_paginate @posts %>
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            <%= render 'all_tags_list' %>
         
     | 
| 
      
 13 
     | 
    
         
            +
            <%= render( 'admin_context_menu', page: @page) %>
         
     | 
| 
      
 14 
     | 
    
         
            +
            <%# partial in tkh_menus gem or has to be added in host app %>
         
     | 
| 
      
 15 
     | 
    
         
            +
            <%= render './shared/menus' %>
         
     | 
| 
         @@ -1,9 +1,15 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <p class="meta-info">
         
     | 
| 
       2 
     | 
    
         
            -
            	<%= post.author.name %> 
     | 
| 
       3 
     | 
    
         
            -
            	<%= post.published_at ? link_to(l(post.published_at, format: :tkh_default), post) :  t('pages.not_published_yet') %> 
     | 
| 
       4 
     | 
    
         
            -
            	<%= "#{t('activerecord.models.comments')}#{t('colon')} #{post.comments.showable.for_locale(I18n.locale.to_s).count}" %>
         
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
       6 
     | 
    
         
            -
             
     | 
| 
       7 
     | 
    
         
            -
                 
     | 
| 
      
 1 
     | 
    
         
            +
            <p class="post-meta-info">
         
     | 
| 
      
 2 
     | 
    
         
            +
            	<%= content_tag :span, post.author.name, class: 'author-name' %>
         
     | 
| 
      
 3 
     | 
    
         
            +
            	<%= content_tag :span, (post.published_at ? link_to(l(post.published_at, format: :tkh_default), post) :  t('pages.not_published_yet')), class: 'published-date' %>
         
     | 
| 
      
 4 
     | 
    
         
            +
            	<%= content_tag :span, "#{t('activerecord.models.comments')}#{t('colon')} #{post.comments.showable.for_locale(I18n.locale.to_s).count}", class: 'comment-count' %>
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
              <% if post.tags.count > 0 %>
         
     | 
| 
      
 7 
     | 
    
         
            +
                <span class="tag-list">
         
     | 
| 
      
 8 
     | 
    
         
            +
                  <%= render :partial => 'blog/individual_tag', collection: post.tags.alphabetically, as: :tag %>
         
     | 
| 
      
 9 
     | 
    
         
            +
                </span>
         
     | 
| 
      
 10 
     | 
    
         
            +
              <% end %>
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
              <% if administrator? %>
         
     | 
| 
      
 13 
     | 
    
         
            +
                <%= content_tag :span, (link_to t('edit'), edit_page_path(post), class: 'btn btn-xs btn-primary'), class: 'edit-button' %>
         
     | 
| 
       8 
14 
     | 
    
         
             
              <% end %>
         
     | 
| 
       9 
15 
     | 
    
         
             
            </p>
         
     | 
| 
         @@ -1,10 +1,12 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            <%= simple_form_for @page, :html => { class: 'form-horizontal', role: 'form' } do |f| %>
         
     | 
| 
       2 
2 
     | 
    
         
             
            	<%= f.error_notification %>
         
     | 
| 
       3 
3 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 4 
     | 
    
         
            +
            		<%= f.input :title,
         
     | 
| 
      
 5 
     | 
    
         
            +
            								label: t('activerecord.attributes.pages.title'),
         
     | 
| 
      
 6 
     | 
    
         
            +
            								hint: t('pages.hint.title'),
         
     | 
| 
      
 7 
     | 
    
         
            +
            								input_html: { size: 45 } %>
         
     | 
| 
       6 
8 
     | 
    
         
             
            		<%= f.input :for_blog, label: t('activerecord.attributes.pages.for_the_blog') %>
         
     | 
| 
       7 
     | 
    
         
            -
            		<%= f.input :tag_list, hint: 'space separated', :wrapper_html => { :id => 'page-tag-list' } %>
         
     | 
| 
      
 9 
     | 
    
         
            +
            		<%= f.input :tag_list, hint: 'space separated', :wrapper_html => { :id => 'page-tag-list' }, input_html: { size: 45 } %>
         
     | 
| 
       8 
10 
     | 
    
         
             
            		<%= f.input :short_title, label: t('activerecord.attributes.pages.short_title'), hint: t('pages.hint.short_title'), :wrapper_html => { :id => 'page-short-title' } %>
         
     | 
| 
       9 
11 
     | 
    
         
             
            		<%= f.input :parent_page_title,
         
     | 
| 
       10 
12 
     | 
    
         
             
            								as: :string,
         
     | 
| 
         @@ -15,7 +17,7 @@ 
     | 
|
| 
       15 
17 
     | 
    
         
             
            																:data => { 	provide: 'typeahead',
         
     | 
| 
       16 
18 
     | 
    
         
             
            																	 					source: Page.not_for_blog.by_title.map(&:title).to_json }
         
     | 
| 
       17 
19 
     | 
    
         
             
            																	} %>
         
     | 
| 
       18 
     | 
    
         
            -
            	  <%= f.input :description, label: t('activerecord.attributes.pages.description'), :input_html => { :rows  
     | 
| 
      
 20 
     | 
    
         
            +
            	  <%= f.input :description, label: t('activerecord.attributes.pages.description'), :input_html => { cols: 45, rows: 3 } %>
         
     | 
| 
       19 
21 
     | 
    
         
             
            		<%= f.input :body, label: t('activerecord.attributes.pages.body'), :input_html => { :rows => 35, :class => 'ckeditor' } %>
         
     | 
| 
       20 
22 
     | 
    
         | 
| 
       21 
23 
     | 
    
         
             
            		<% if controller.action_name == 'edit' # the current_user is the page creator in create method %>
         
     | 
| 
         @@ -24,14 +26,13 @@ 
     | 
|
| 
       24 
26 
     | 
    
         
             
            									:wrapper_html => { :id => 'author-name' },
         
     | 
| 
       25 
27 
     | 
    
         
             
            									label: "author name",
         
     | 
| 
       26 
28 
     | 
    
         
             
            									:input_html => {
         
     | 
| 
      
 29 
     | 
    
         
            +
            																	size: 45,
         
     | 
| 
       27 
30 
     | 
    
         
             
            																	:autocomplete => 'off',
         
     | 
| 
       28 
31 
     | 
    
         
             
            																	:data => { 	source: User.administrators.alphabetically.map(&:formal_name).to_json }
         
     | 
| 
       29 
32 
     | 
    
         
             
            																		} %>
         
     | 
| 
       30 
33 
     | 
    
         
             
            		<% end -%>
         
     | 
| 
       31 
     | 
    
         
            -
            	</div>
         
     | 
| 
       32 
34 
     | 
    
         | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
            		<br />
         
     | 
| 
       34 
36 
     | 
    
         
             
                <%= f.button :submit, :class => 'btn btn-primary' %>
         
     | 
| 
       35 
     | 
    
         
            -
              </div>
         
     | 
| 
       36 
37 
     | 
    
         | 
| 
       37 
38 
     | 
    
         
             
            <% end %>
         
     | 
| 
         @@ -13,9 +13,11 @@ 
     | 
|
| 
       13 
13 
     | 
    
         
             
            	<%= render '/pages/blog_post_meta', post: @page %>
         
     | 
| 
       14 
14 
     | 
    
         
             
            	<%= raw tkhed(@page.body) %>
         
     | 
| 
       15 
15 
     | 
    
         
             
            	<%= render 'comment_section' if Setting.first.enable_comments_in_blog? %>
         
     | 
| 
      
 16 
     | 
    
         
            +
              <%= render 'blog/all_tags_list' %>
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
18 
     | 
    
         
             
            <% end -%>
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
       19 
20 
     | 
    
         
             
            <%= render( 'admin_context_menu', page: @page) %>
         
     | 
| 
       20 
21 
     | 
    
         
             
            <%# partial in tkh_menus gem or has to be added in host app %>
         
     | 
| 
       21 
22 
     | 
    
         
             
            <%= render './shared/menus' %>
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
    
        data/config/routes.rb
    CHANGED
    
    | 
         @@ -6,13 +6,13 @@ Rails.application.routes.draw do 
     | 
|
| 
       6 
6 
     | 
    
         
             
                    post :unpublish
         
     | 
| 
       7 
7 
     | 
    
         
             
                    post :toggle_for_blog
         
     | 
| 
       8 
8 
     | 
    
         
             
                  end
         
     | 
| 
       9 
     | 
    
         
            -
                  collection do 
     | 
| 
      
 9 
     | 
    
         
            +
                  collection do
         
     | 
| 
       10 
10 
     | 
    
         
             
                    post :sort
         
     | 
| 
       11 
11 
     | 
    
         
             
                  end
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       14 
14 
     | 
    
         
             
                resources :contacts
         
     | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
       16 
16 
     | 
    
         
             
                resources :comments do
         
     | 
| 
       17 
17 
     | 
    
         
             
                  collection do
         
     | 
| 
       18 
18 
     | 
    
         
             
                    get :pending
         
     | 
| 
         @@ -26,7 +26,7 @@ Rails.application.routes.draw do 
     | 
|
| 
       26 
26 
     | 
    
         
             
                  end
         
     | 
| 
       27 
27 
     | 
    
         
             
                end
         
     | 
| 
       28 
28 
     | 
    
         
             
                get 'blog' => 'blog#index', as: :blog
         
     | 
| 
       29 
     | 
    
         
            -
                get ' 
     | 
| 
       30 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
                get 'blog_by_tag/:id', :to => 'blog#by_tag', :as => 'blog_by_tag'
         
     | 
| 
      
 30 
     | 
    
         
            +
             
     | 
| 
       31 
31 
     | 
    
         
             
              end
         
     | 
| 
       32 
     | 
    
         
            -
            end
         
     | 
| 
      
 32 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -3,11 +3,11 @@ 
     | 
|
| 
       3 
3 
     | 
    
         
             
            	<head>
         
     | 
| 
       4 
4 
     | 
    
         
             
            	  <title>
         
     | 
| 
       5 
5 
     | 
    
         
             
            			<% if defined?(SETTINGS) && SETTINGS['site_name'] %>
         
     | 
| 
       6 
     | 
    
         
            -
            				<%= @meta_title ? "#{@meta_title} | #{SETTINGS['site_name']}" : SETTINGS['site_name'] %> 
     | 
| 
      
 6 
     | 
    
         
            +
            				<%= @meta_title ? "#{@meta_title} | #{SETTINGS['site_name']}" : SETTINGS['site_name'] %>
         
     | 
| 
       7 
7 
     | 
    
         
             
            			<% else %>
         
     | 
| 
       8 
8 
     | 
    
         
             
            				<%= @meta_title ? @meta_tile : 'A web site powered by tkh_cms' %>
         
     | 
| 
       9 
9 
     | 
    
         
             
            			<% end -%>
         
     | 
| 
       10 
     | 
    
         
            -
            		- The blog</title> 
     | 
| 
      
 10 
     | 
    
         
            +
            		- The blog</title>
         
     | 
| 
       11 
11 
     | 
    
         
             
            	  <meta name="description" content="<%= @meta_description -%>">
         
     | 
| 
       12 
12 
     | 
    
         
             
            	  <%= stylesheet_link_tag    "application", :media => "all" %>
         
     | 
| 
       13 
13 
     | 
    
         
             
            		<%= favicon_link_tag '/favicon.ico' %>
         
     | 
| 
         @@ -16,23 +16,23 @@ 
     | 
|
| 
       16 
16 
     | 
    
         
             
            	<body>
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
            		<div id="content">
         
     | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
       20 
     | 
    
         
            -
            			<article> 
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            			<article>
         
     | 
| 
       21 
21 
     | 
    
         
             
            				<% flash.each do |name, msg| %>
         
     | 
| 
       22 
22 
     | 
    
         
             
            				  <%= content_tag :div, msg, :id => "flash_#{name}" %>
         
     | 
| 
       23 
23 
     | 
    
         
             
            				<% end %>
         
     | 
| 
       24 
     | 
    
         
            -
             
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
       25 
25 
     | 
    
         
             
            				<h1>The blog</h1>
         
     | 
| 
       26 
     | 
    
         
            -
             
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
       27 
27 
     | 
    
         
             
            				<%= yield %>
         
     | 
| 
       28 
28 
     | 
    
         
             
            			</article>
         
     | 
| 
       29 
     | 
    
         
            -
             
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
       30 
30 
     | 
    
         
             
            			<aside>
         
     | 
| 
       31 
31 
     | 
    
         
             
            				<%# = render 'shared/sidebar' %>
         
     | 
| 
       32 
32 
     | 
    
         
             
            			</aside>
         
     | 
| 
       33 
     | 
    
         
            -
             
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
       34 
34 
     | 
    
         
             
            		</div>
         
     | 
| 
       35 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
       36 
36 
     | 
    
         
             
            	  <%= javascript_include_tag "application" %>
         
     | 
| 
       37 
37 
     | 
    
         
             
            	</body>
         
     | 
| 
       38 
38 
     | 
    
         
             
            </html>
         
     | 
    
        data/lib/tkh_content/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: tkh_content
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.9. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.9.8
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Swami Atma
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2014-03- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2014-03-07 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rails
         
     | 
| 
         @@ -160,6 +160,10 @@ files: 
     | 
|
| 
       160 
160 
     | 
    
         
             
            - app/models/page.rb
         
     | 
| 
       161 
161 
     | 
    
         
             
            - app/models/tag.rb
         
     | 
| 
       162 
162 
     | 
    
         
             
            - app/models/tagging.rb
         
     | 
| 
      
 163 
     | 
    
         
            +
            - app/views/blog/_admin_context_menu.html.erb
         
     | 
| 
      
 164 
     | 
    
         
            +
            - app/views/blog/_all_tags_list.html.erb
         
     | 
| 
      
 165 
     | 
    
         
            +
            - app/views/blog/_individual_tag.html.erb
         
     | 
| 
      
 166 
     | 
    
         
            +
            - app/views/blog/by_tag.html.erb
         
     | 
| 
       163 
167 
     | 
    
         
             
            - app/views/blog/index.atom.builder
         
     | 
| 
       164 
168 
     | 
    
         
             
            - app/views/blog/index.html.erb
         
     | 
| 
       165 
169 
     | 
    
         
             
            - app/views/comments/_form.html.erb
         
     |