Permalink
Please sign in to comment.
Showing
with
107 additions
and 367 deletions.
- +0 −4 Gemfile
- +0 −9 Gemfile.lock
- +0 −11 app/assets/stylesheets/application.css
- +1 −1 app/controllers/settings_controller.rb
- +0 −24 app/controllers/weblogs_controller.rb
- +0 −5 app/models/user.rb
- +0 −9 app/models/weblog.rb
- +0 −63 app/views/layouts/weblogs.html.erb
- +0 −12 app/views/settings/index.html.erb
- +0 −44 app/views/weblogs/index.html.erb
- +99 −110 config/routes.rb
- +6 −0 db/migrate/20140901013149_drop_weblogs.rb
- +1 −17 db/schema.rb
- +0 −58 script/update_weblogs
| @@ -1,24 +0,0 @@ | ||
| class WeblogsController < ApplicationController | ||
| before_filter { @page = page } | ||
| WEBLOGS_PER_PAGE = 10 | ||
| def index | ||
| @pages = (Weblog.count / WEBLOGS_PER_PAGE.to_f).ceil | ||
| if @page > @pages | ||
| @page = @pages | ||
| end | ||
| @show_more = @page < @pages | ||
| @weblogs = Weblog.order("created_at DESC"). | ||
| offset((@page - 1) * WEBLOGS_PER_PAGE). | ||
| limit(WEBLOGS_PER_PAGE) | ||
| render :action => "index" | ||
| end | ||
| private | ||
| def page | ||
| params[:page].to_i > 0 ? params[:page].to_i : 1 | ||
| end | ||
| end |
| @@ -1,9 +0,0 @@ | ||
| class Weblog < ActiveRecord::Base | ||
| belongs_to :user | ||
| serialize :tags, Array | ||
| def sanitized_content | ||
| Loofah.fragment(self.content).scrub!(:strip).scrub!(:nofollow).to_s.html_safe | ||
| end | ||
| end |
| @@ -1,63 +0,0 @@ | ||
| <!DOCTYPE html> | ||
| <html> | ||
| <head> | ||
| <meta http-equiv="content-type" content="text/html; charset=utf-8" /> | ||
| <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /> | ||
| <link rel="apple-touch-icon" sizes="57x57" href="/apple-touch-icon.png" /> | ||
| <link rel="apple-touch-icon" sizes="114x114" href="/apple-touch-icon.png" /> | ||
| <link rel="apple-touch-icon" sizes="72x72" href="/apple-touch-icon-144.png" /> | ||
| <link rel="apple-touch-icon" sizes="144x144" href="/apple-touch-icon-144.png" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <meta name="robots" content="noarchive,noodp,noydir" /> | ||
| <meta name="referrer" content="always" /> | ||
| <% if @short_url %> | ||
| <link rev="canonical" rel="self alternate shorter shorturl shortlink" | ||
| href="<%= @short_url %>" /> | ||
| <% end %> | ||
| <title><%= @title.present? ? "#{@title} | " : "" %>Planet <%= | ||
| Rails.application.name %></title> | ||
| <%= stylesheet_link_tag "application", :media => "all" %> | ||
| <% if @user %> | ||
| <%= javascript_include_tag "application" %> | ||
| <script> | ||
| Lobsters.curUser = '<%= @user.id %>'; | ||
| </script> | ||
| <% end %> | ||
| <%= csrf_meta_tags %> | ||
| </head> | ||
| <body> | ||
| <div id="wrapper"> | ||
| <div id="header"> | ||
| <div id="headerleft"> | ||
| <a id="l_holder" style="background-color: #<%= sprintf("%02x%02x%02x", | ||
| [ 255, (@traffic * 7).floor + 50.0 ].min, 0, 0) %>;" href="/" | ||
| title="<%= Rails.application.name %> (<%= @traffic.to_i %>)"></a> | ||
| <span id="headertitle"> | ||
| <a href="/">Planet <%= Rails.application.name %></a> | ||
| </span> | ||
| </div> | ||
| <div id="headerright"> | ||
| <span class="headerlinks"> | ||
| <a href="<%= main_root_url %>"><%= Rails.application.name %></a> | ||
| </span> | ||
| </div> | ||
| <div class="clear"></div> | ||
| </div> | ||
| <div id="inside"> | ||
| <% if flash[:error] %> | ||
| <div class="flash-error"><%= flash[:error] %></div> | ||
| <% elsif flash[:success] %> | ||
| <div class="flash-success"><%= flash[:success] %></div> | ||
| <% end %> | ||
| <%= yield %> | ||
| <div class="clear"></div> | ||
| </div> | ||
| </div> | ||
| </body> | ||
| </html> | ||
| @@ -1,44 +0,0 @@ | ||
| <ol class="stories list"> | ||
| <% @weblogs.each do |weblog| %> | ||
| <li class="story"> | ||
| <div class="story_liner"> | ||
| <div class="details"> | ||
| <span class="link"> | ||
| <a href="<%= weblog.url %>"><%= weblog.title %></a> | ||
| </span> | ||
| <span class="tags"> | ||
| <% weblog.tags.map{|t| t.downcase }.sort.each do |tag| %> | ||
| <a href="<%= main_root_url %>t/<%= tag %>" class="tag"><%= tag %></a> | ||
| <% end %> | ||
| </span> | ||
| <span class="domain"> | ||
| <a href="<%= weblog.site_url %>"><%= weblog.site_title %></a> | ||
| </span> | ||
| <div class="byline"> | ||
| by <a href="<%= main_root_url %>u/<%= weblog.user.username %>"><%= | ||
| weblog.user.username %></a> | ||
| <%= raw(time_ago_in_words_label(weblog.created_at). | ||
| gsub(/^about /, "")) %> ago | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class="story_content weblog_content shorten_first_p"> | ||
| <%= weblog.sanitized_content %> | ||
| </div> | ||
| </li> | ||
| <% end %> | ||
| </ol> | ||
| <div class="morelink"> | ||
| <% if @page && @page > 1 %> | ||
| <a href="/<%= @page == 2 ? "" : "page/#{@page - 1}" %>"><< Page | ||
| <%= @page - 1 %></a> | ||
| <% end %> | ||
| <% if @show_more %> | ||
| <% if @page && @page > 1 %> | ||
| | | ||
| <% end %> | ||
| <a href="/page/<%= @page + 1 %>">Page <%= @page + 1 %> >></a> | ||
| <% end %> | ||
| </div> |
Oops, something went wrong.
0 comments on commit
dfe6db4