rails 4 and tons of stuff

This commit is contained in:
jomo
2014-04-14 06:26:37 +02:00
parent b740c4db3a
commit 7135d2690c
41 changed files with 349 additions and 206 deletions

View File

@@ -2,7 +2,7 @@
<p id="markdown-note">Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!</p>
<%= simple_form_for @post do |f|%>
<%= f.input :title, :label => false %>
<%= f.hidden_field :content, :label => false, input_html: {class: "full-width vertical"} %>
<%= f.submit "Update Post", class: "btn blue left" %>
<%= f.text_area :content, :label => false, input_html: {class: "full-width vertical"} %>
<p><%= f.submit "Update Post", class: "btn blue left" %></p>
<% end %>
<%= button_to "Delete post", @post, :method => "delete", :confirm => "Delete post & comments forever?", class: "btn red right" %>
<p><%= button_to "Delete post", @post, :method => "delete", :confirm => "Delete post & comments forever?", class: "btn red right" %></p>

View File

@@ -11,7 +11,7 @@ atom_feed do |feed|
end
entry.url blogpost_url(post)
entry.title post.title
entry.content Sanitize.clean(GitHub::Markdown.render_gfm(post.content), Sanitize::Config::RELAXED).html_safe, :type => 'html'
entry.content Sanitize.clean(render_md(post.content), Sanitize::Config::RELAXED).html_safe, :type => 'html'
end
end
end

View File

@@ -1,3 +1,4 @@
<h1>News</h1>
<%= link_to 'Make new Post', new_blogpost_path, class: "btn blue" if mod? %>
<div id="posts">
<% @posts.each do |p| %>
@@ -12,7 +13,7 @@
<div class="items">
<div class="item content post">
<h2 class="headline"><%= link_to truncate(p.title, length: 60, omission: " …"), p %></h2>
<%= Sanitize.clean(GitHub::Markdown.render_gfm(p.content), Sanitize::Config::RELAXED).html_safe %>
<%= Sanitize.clean(render_md(p.content), Sanitize::Config::RELAXED).html_safe %>
</div>
</div>
</div>

View File

@@ -1,7 +1,7 @@
<h1>New Post</h1>
<p id="markdown-note">Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!</p>
<%= simple_form_for @post do |f|%>
<%= f.input :title, placeholder: "Title" %>
<%= f.hidden_field :content, placeholder: "Text", input_html: {class: "full-width vertical"} %>
<%= f.submit "Create Post", class: "btn blue left" %>
<p id="markdown-note">Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!</p>
<%= f.text_area :content, placeholder: "Text", input_html: {class: "full-width vertical"} %>
<p><%= f.submit "Create Post", class: "btn blue left" %></p>
<% end %>

View File

@@ -1,3 +1,4 @@
<%= link_to "News", blogposts_path %> → <%= link_to @post.title %>
<div class="item-group post with-avatar" id="post-<%= @post.id %>">
<%= link_to(image_tag(@post.author.avatar_url(64), class: "avatar"), @post.author, title: @post.author.ign) %>
<div class="header">
@@ -7,14 +8,14 @@
<div class="items">
<div class="item content">
<h2 class="headline"><%= link_to truncate(@post.title, length: 60, omission: " …"), p %></h2>
<%= Sanitize.clean(GitHub::Markdown.render_gfm(@post.content), Sanitize::Config::RELAXED).html_safe %>
<%= Sanitize.clean(render_md(@post.content), Sanitize::Config::RELAXED).html_safe %>
</div>
</div>
</div>
<div id="comments">
<h3><%= "#{pluralize(@post.comments.length, 'comment')}." %></h3>
<% @post.comments.each do |c| %>
<%= render "comments/comment", :c => c %>
<%= render "comments/comment", c: c %>
<% end %>
<%= render "comments/new" %>
</div>

View File

@@ -6,7 +6,7 @@
</div>
<div class="items">
<div class="item content">
<%= h(c.content).gsub(/(\s*?[\r\n]){3,}/, "\n\n").gsub("\n", "<br>").html_safe %>
<%= Sanitize.clean(render_mini_md(c.content.gsub(/([\r\n]+\s*?){3,}/, "\n\n")), Sanitize::Config::BASIC).html_safe %>
</div>
</div>
</div>

View File

@@ -1,6 +1,7 @@
<% if current_user %>
<h3>New comment</h3>
<%= simple_form_for [@post, @comment] do |f| %>
<p>> quote | _underline_ | *italic* | **bold** | `code` | [link](https://example.com)
<%= f.input :content, :label => false, :as => "text", :placeholder => "Comment", input_html: {class: "comment"} %>
<%= f.submit class: "btn blue" %>
<% end %>

View File

@@ -2,6 +2,6 @@
<%= simple_form_for [@comment.blogpost, @comment] do |f| %>
<%= f.input :content, label: false, as: "text", placeholder: "Comment" %>
<%= f.submit "Update Comment", class: "btn blue left" %>
<p><%= f.submit "Update Comment", class: "btn blue left" %></p>
<% end %>
<%= button_to "Delete comment", [@comment.blogpost, @comment] , method: "delete", confirm: "Delete comment forever?", class: "btn red right" %>
<p><%= button_to "Delete comment", [@comment.blogpost, @comment] , method: "delete", confirm: "Delete comment forever?", class: "btn red right" %></p>

View File

@@ -1,4 +1,17 @@
<h1>Edit forum group</h1>
<h1>Manage Forums</h1>
<div class="item-group">
<div class="header">
Forums
</div>
<div class="items bold">
<% @group.forums.each do |forum| %>
<%= link_to forum.name, edit_forum_path(forum), class: "item" %>
<% end %>
<div class="item"><%= link_to "Add Forum", new_forum_path(forumgroup: @group), class: "btn blue" %></div>
</div>
</div>
<hr>
<h1>Edit Forum Group</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
<%= form_for @group do |f|%>
<table>
@@ -19,6 +32,6 @@
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
</table>
<%= f.submit "Update group", class: "btn blue" %>
<p><%= f.submit "Update group", class: "btn blue" %></p>
<% end %>
<%= button_to "Delete group", @post, :method => "delete", :confirm => "Delete group?\nForums + Threads will not be accessible!", class: "btn red right" %>
<p><%= button_to "Delete group", @post, :method => "delete", :confirm => "Delete group?\nForums + Threads will not be accessible!", class: "btn red right" %></p>

View File

@@ -19,5 +19,5 @@
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
</table>
<%= f.submit "Create group", class: "btn blue" %>
<p><%= f.submit "Create group", class: "btn blue" %></p>
<% end %>

View File

@@ -0,0 +1,24 @@
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → <%= link_to @forum.name, @forum %>
<h1>Edit Forum</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
<%= form_for @forum do |f|%>
<table>
<tr>
<td><%= f.label :name %></td>
<td><%= f.text_field :name, placeholder: "Name" %></td>
</tr>
<tr>
<td><%= f.label :position %></td>
<td><%= f.number_field :position, placeholder: "Position" %></td>
</tr>
<tr>
<td><%= f.label :role_read_id, "Min. read role" %></td>
<td><%= f.select :role_read_id, role_selection, include_blank: "None" %></td>
</tr>
<tr>
<td><%= f.label :role_write_id, "Min. write role" %></td>
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
</table>
<p><%= f.submit "Update forum", class: "btn blue" %></p>
<% end %>

View File

@@ -1,10 +1,9 @@
<div id="forum_groups">
<% @groups.each do |group| %>
<div class="item-group" id="forums-<%= group.id %>">
<div class="item-group" id="forum-<%= group.id %>">
<div class="header">
<%= group.name %>
<%= link_to "edit", edit_forumgroup_path(group), class: "editlink" if admin? %>
<%= link_to "+", new_forum_path(forumgroup: group), class: "editlink" if admin? %>
</div>
<div class="items bold">

View File

@@ -1,5 +1,5 @@
<%= link_to @group, forumgroup_path(@group) %> → New forum
<h1>New forum forum</h1>
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → New forum
<h1>New Forum</h1>
<% role_selection = Role.all_from_to(:normal, :admin).collect{|p|[p.name, p.id]} %>
<%= form_for @forum do |f|%>
<table>
@@ -20,6 +20,6 @@
<td><%= f.select :role_write_id, role_selection, include_blank: false %></td>
</tr>
</table>
<%= f.hidden_field :forumgroup_id, value: @group.id %>
<%= f.submit "Create forum", class: "btn blue" %>
<%= f.hidden_field :forumgroup_id, value: @forum.group.id %>
<p><%= f.submit "Create forum", class: "btn blue" %></p>
<% end %>

View File

@@ -17,4 +17,6 @@
</div>
<% end %>
</div>
<p><%= link_to "New thread", new_forumthread_path(forum_id: @forum), class: "btn blue" %></p>
<% if @forum.can_write?(current_user) %>
<p><%= link_to "New thread", new_forumthread_path(forum: @forum), class: "btn blue" %></p>
<% end %>

View File

@@ -2,7 +2,7 @@
<p id="markdown-note">Note: You can use <%= link_to "Markdown", "https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet", target: "_blank" %>!</p>
<%= simple_form_for [@thread.forum, @thread] do |f|%>
<%= f.input :title, label: false %>
<%= f.hidden_field :content, label: false, input_html: {class: "full-width vertical"} %>
<%= f.text_area :content, label: false, input_html: {class: "full-width vertical"} %>
<%= f.submit "Update thread", class: "btn blue left" %>
<% end %>
<%= button_to "Delete thread", [@thread.forum, @thread], :method => "delete", :confirm => "Delete thread & comments forever?", class: "btn red right" %>

View File

@@ -1,6 +1,6 @@
<%= link_to @forum.group, forumgroup_path(@forum.group) %> → <%= link_to @forum, @forum %> → New thread
<%= link_to @thread.forum.group, forumgroup_path(@thread.forum.group) %> → <%= link_to @thread.forum, @thread.forum %> → New thread
<h1>New thread</h1>
<%= form_for [@forum, @thread] do |f|%>
<%= form_for @thread do |f|%>
<table>
<% if mod? %>
<tr>
@@ -16,6 +16,6 @@
<div id="form_inputs">
<%= f.text_field :title, placeholder: "Title" %>
</div>
<%= f.hidden_field :content, placeholder: "Text" %>
<%= f.text_area :content, placeholder: "Text" %>
<p><%= f.submit "Create thread", class: "btn blue" %></p>
<% end %>

View File

@@ -8,7 +8,7 @@
<div class="items">
<div class="item content">
<h2 class="headline"><%= link_to truncate(@thread.title, length: 60, omission: " …"), p %></h2>
<%= Sanitize.clean(GitHub::Markdown.render_gfm(@thread.content), Sanitize::Config::RELAXED).html_safe %>
<%= Sanitize.clean(render_md(@thread.content), Sanitize::Config::RELAXED).html_safe %>
</div>
</div>
</div>

View File

@@ -21,7 +21,7 @@ Hi <%= @user.name %>!
<p>Please click this link to confirm your registration:
<div style="background-color: #eeeeee; padding: 1em; margin: 0; text-align: center;" width="100%">
<%= link_to "confirm my email", confirm_user_path(@user, code: @user.email_token, only_path: false), style: "text-decoration: none; color: #f2f2f2; padding: 0.5em 2em; background-color: #4096EE; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; display: inline-block; text-transform: uppercase;" %>
<%= link_to "confirm registration", confirm_user_path(@user, code: @user.email_token, only_path: false), style: "text-decoration: none; color: #f2f2f2; padding: 0.5em 2em; background-color: #4096EE; border-radius: 5px; -moz-border-radius: 5px; -webkit-border-radius: 5px; display: inline-block; text-transform: uppercase;" %>
</div>
</p>