homeland-wiki 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: d90b7e70032d93f27d6990634376753bad2b8999
4
- data.tar.gz: f9ac687c6fa4e642ec7d5f15ab567e3bd3a3e988
2
+ SHA256:
3
+ metadata.gz: e1a080891632677ec4ff8f22586b7de379135cfb600e3cd3a81b82b60d9fa779
4
+ data.tar.gz: 84886ed59a8da4472e7076760b56885669f3f0992befbe630ddddf8aa75e00bc
5
5
  SHA512:
6
- metadata.gz: f022f99c9daad87c22e2d5c5f4fc09a94afc17f325017e47c8b30e51670f5cb7aee1c02209d98ef410530a710c97ab27c52b8327c045bfabb8ce34754c12ae32
7
- data.tar.gz: 3ef8903c434e0da5330cc1ab9436b0b836084f6410e27487455abdc12488058cde6e2fd0126fd00c65915a45537d324e27643796529695425b8c2c8820e72a1c
6
+ metadata.gz: 12f51ec3a5690418e0497d768c4c6df915a1d82f8240b81f63eb0c2dd468c199a7818e822f885a831451ebd22eaf7245f07fd92a9af93356b182a49f5eac12e1
7
+ data.tar.gz: fa72b3fff5b49096097ac11a520380644ba332f4bf7264a37e5fe2a580cb4bdc2d8903843f4a2adc4414b6dd31f5e72cf6f26ce9da72c67763b12e8f4987bfe2
@@ -5,29 +5,33 @@
5
5
  window.WikiView = Backbone.View.extend
6
6
  el: "body"
7
7
  events:
8
- "click .editor-toolbar .edit a": "toggleEditView"
9
- "click .editor-toolbar .preview a": "togglePreviewView"
8
+ "click .editor-toolbar .preview": "togglePreviewView"
10
9
 
11
10
  initialize: (opts) ->
12
11
  @parentView = window._appView
13
- $("<div id='preview' class='markdown form-control'></div>").insertAfter( $('#page_body') )
12
+ $("<div id='preview' class='markdown form-control'></div>").insertAfter($("#page_body"))
13
+ $("#preview").hide()
14
14
  window._editor = new Editor()
15
15
 
16
- toggleEditView: (e) ->
17
- $(e.target).parent().addClass('active')
18
- $('.preview a').parent().removeClass('active')
19
- $('#preview').hide()
20
- $('#page_body').show()
21
- false
22
-
23
16
  togglePreviewView: (e) ->
24
- $(e.target).parent().addClass('active')
25
- $('.edit a').parent().removeClass('active')
26
- $('#preview').html('Loading...')
27
- $('#page_body').hide()
28
- $('#preview').show()
29
- $.post '/wiki/preview', {body: $('#page_body').val()}, (data)->
30
- $('#preview').html(data)
17
+ textarea = $("#page_body")
18
+ preview_box = $("#preview")
19
+
20
+ if $(e.target).hasClass("active")
21
+ $(e.target).removeClass("active")
22
+ preview_box.hide()
23
+ textarea.show()
24
+ else
25
+ $(e.target).addClass("active")
26
+ preview_box.show()
27
+ preview_box.css("height", textarea.height())
28
+ textarea.hide()
29
+ this.preview(preview_box, textarea.val())
30
+ return false
31
+
32
+ preview: (preview_box, val) ->
33
+ $.post '/wiki/preview', { body: val }, (data)->
34
+ preview_box.html(data)
31
35
  false
32
36
  false
33
37
 
@@ -11,10 +11,11 @@
11
11
  }
12
12
 
13
13
  .page-detail {
14
- .panel-heading {
14
+ .card-header {
15
15
  padding: 15px;
16
16
  h1 { font-size: 20px; color: #111; margin: 0; margin-bottom: 6px;}
17
17
  }
18
+
18
19
  .info {
19
20
  text-align:right;
20
21
  padding:10px;
@@ -24,6 +25,7 @@
24
25
  border-radius: 3px 3px 0 0;
25
26
  margin-bottom:20px;
26
27
  }
28
+
27
29
  .editors {
28
30
  h3 { font-size:14px; color:#999;}
29
31
  .media-object { display: inline; }
@@ -1,12 +1,29 @@
1
- <%= simple_form_for([:admin,@page]) do |f| %>
1
+ <%= form_for [:admin, @page] do |f| %>
2
2
  <%= render "shared/error_messages", target: @page %>
3
- <fieldset>
4
- <legend>Wiki页面编辑</legend>
5
- <%= f.input :locked, as: :boolean, hint: "锁定后,前台非管理员将无法修改。" %>
6
- <%= f.input :slug %>
7
- <%= f.input :title, input_html: { class: "xxlarge" } %>
8
- <%= f.input :body, as: :text, input_html: { class: "span8", rows: "30"} %>
9
- <div class="form-actions">
10
- <%= f.submit t("common.save"), class: "btn btn-primary", 'data-disable-with' => t("common.saving") %>
11
- </div>
3
+
4
+ <div class="form-group form-check">
5
+ <%= f.check_box :locked, class: "form-check-input" %>
6
+ <%= f.label :locked, class: "form-check-label" %>
7
+ <div class="form-text">锁定后,前台非管理员将无法修改。</div>
8
+ </div>
9
+
10
+ <div class="form-group">
11
+ <%= f.label :slug %>
12
+ <%= f.text_field :slug, class: "form-control" %>
13
+ </div>
14
+
15
+ <div class="form-group">
16
+ <%= f.label :title %>
17
+ <%= f.text_field :title, class: "form-control" %>
18
+ </div>
19
+
20
+ <div class="form-group">
21
+ <%= f.label :body %>
22
+ <%= f.text_area :body, class: "form-control", rows: 30 %>
23
+ </div>
24
+
25
+ <div class="form-actions">
26
+ <%= f.submit t("common.save"), class: "btn btn-primary", 'data-disable-with' => t("common.saving") %>
27
+ <%= link_to "取消", admin_pages_path, class: "btn btn-outline-primary" %>
28
+ </div>
12
29
  <% end %>
@@ -1,25 +1,41 @@
1
- <%= simple_form_for @page do |f| %>
1
+ <%= form_for @page do |f| %>
2
2
  <%= render "shared/error_messages", target: @page %>
3
3
 
4
- <%= f.input :slug, hint: "#{Setting.base_url}/wiki/:slug"%>
5
- <%= f.input :title, input_html: { class: "xxlarge" } %>
4
+ <div class="form-group">
5
+ <%= f.label :slug %>
6
+ <%= f.text_field :slug, class: "form-control" %>
7
+ <div class="form-text">
8
+ <%= Setting.base_url %>/wiki/:slug
9
+ </div>
10
+ </div>
11
+
12
+ <div class="form-group">
13
+ <%= f.label :title %>
14
+ <%= f.text_field :title, class: "form-control" %>
15
+ </div>
6
16
 
7
17
  <div class="edit-tools">
8
18
  <%= render "/shared/editor_toolbar" %>
9
19
  </div>
10
20
 
11
21
  <div class="form-group">
12
- <%= f.text_area :body, rows: 30, class: 'form-control topic-editor' %>
13
- <p class="help-block">
14
- 请使用 Markdown 格式编写,可以试试用 <a href='https://www.typora.io' target='_blank'>Typora</a> 这个 App 来编写。
15
- </p>
22
+ <%= f.text_area :body, rows: 30, class: "form-control topic-editor" %>
23
+
24
+ <div class="form-text">
25
+ 请使用 Markdown 格式编写,可以试试用 <a href="https://www.typora.io" target="_blank">Typora</a> 这个 App 来编写。
26
+ </div>
16
27
  </div>
17
28
 
18
- <% if not @page.new_record? %>
19
- <%= f.input :change_desc, as: :text, input_html: { rows: "2" }, hint: t("pages.describe_this_time_change") %>
29
+ <% if !@page.new_record? %>
30
+ <div class="form-group">
31
+ <%= f.label :change_desc %>
32
+ <%= f.text_area :change_desc, class: "form-control", rows: 2 %>
33
+ <div class="form-text"><%= t("pages.describe_this_time_change") %></div>
34
+ </div>
20
35
  <% end %>
21
- <div class="form-group">
36
+
37
+ <div class="form-actions">
22
38
  <%= f.submit t("common.save"), class: "btn btn-primary", 'data-disable-with' => t("common.saving") %>
23
- <%= link_to t("common.cancel"), pages_path, class: "btn btn-default reset" %>
39
+ <%= link_to t("common.cancel"), pages_path, class: "btn btn-outline-primary" %>
24
40
  </div>
25
41
  <% end %>
@@ -1,6 +1,6 @@
1
- <div class="sidebar wiki-sidebar col-sm-3">
2
- <div class="panel panel-default">
3
- <div class="panel-body">
1
+ <div class="sidebar wiki-sidebar col-sm-3 hide-ios">
2
+ <div class="card">
3
+ <div class="card-body">
4
4
  <strong>导航</strong>
5
5
  <ul>
6
6
  <li><a href="/wiki">首页</a></li>
@@ -1,12 +1,11 @@
1
1
  <% title_tag [t('pages.comments'), @page.title].join(' · ') %>
2
2
 
3
3
  <div class="row">
4
- <div class="hide-ios">
5
- <%= render 'sidebar' %>
6
- </div>
4
+ <%= render 'sidebar' %>
5
+
7
6
  <div class="col-md-9">
8
- <div class="panel panel-default">
9
- <div id="comments" class="panel-body">
7
+ <div class="card">
8
+ <div id="comments" class="card-body">
10
9
  《<%= link_to @page.title, page_path(@page.slug) %>》 - <%= t('pages.comments') %>
11
10
  </div>
12
11
  </div>
@@ -1,8 +1,8 @@
1
1
  <% title_tag t("pages.edit_page") %>
2
2
 
3
- <div class="panel panel-default">
4
- <div class="panel-heading"><%= t("pages.edit_page") %></div>
5
- <div class="panel-body">
3
+ <div class="card">
4
+ <div class="card-header"><%= t("pages.edit_page") %></div>
5
+ <div class="card-body">
6
6
  <%= render "form" %>
7
7
  </div>
8
8
  </div>
@@ -2,10 +2,11 @@
2
2
 
3
3
  <div class="row">
4
4
  <%= render 'sidebar' %>
5
+
5
6
  <% if !turbolinks_app? %>
6
7
  <div class="col-md-9">
7
- <div class="panel panel-default">
8
- <div class="panel-body">
8
+ <div class="card">
9
+ <div class="card-body">
9
10
  <%= raw Setting.wiki_index_html %>
10
11
  </div>
11
12
  </div>
@@ -1,8 +1,8 @@
1
1
  <% title_tag t("pages.edit_page") %>
2
2
 
3
- <div class="panel panel-default">
4
- <div class="panel-heading"><%= t("pages.new_page")%></div>
5
- <div class="panel-body">
3
+ <div class="card">
4
+ <div class="card-header"><%= t("pages.new_page")%></div>
5
+ <div class="card-body">
6
6
  <%= render "form" %>
7
7
  </div>
8
8
  </div>
@@ -1,13 +1,12 @@
1
1
  <% title_tag t('pages.wiki_index') %>
2
2
 
3
3
  <div class="row">
4
- <div class="hide-ios">
5
- <%= render 'sidebar' %>
6
- </div>
4
+ <%= render 'sidebar' %>
5
+
7
6
  <div class="col-md-9">
8
- <div class="panel panel-default">
9
- <div class="panel-heading hide-ios"><%= t('pages.wiki_index') %></div>
10
- <div class="panel-body">
7
+ <div class="card">
8
+ <div class="card-header hide-ios"><%= t('pages.wiki_index') %></div>
9
+ <div class="card-body">
11
10
  <ul>
12
11
  <% @pages.each do |item| %>
13
12
  <li><%= page_title_tag(item) %></li>
@@ -1,13 +1,12 @@
1
1
  <% title_tag @page.title %>
2
2
 
3
3
  <div class="row">
4
- <div class="hide-ios">
5
- <%= render 'sidebar' %>
6
- </div>
4
+ <%= render 'sidebar' %>
5
+
7
6
  <div class="col-md-9 page-detail">
8
- <div class="panel panel-default">
7
+ <div class="card">
9
8
  <% if !@page.locked or admin? %>
10
- <div class="panel-heading">
9
+ <div class="card-header">
11
10
  <h1><%= @page.title %></h1>
12
11
  <div class="infos">
13
12
  <%= link_to comments_page_path(@page.slug) do %>
@@ -22,13 +21,13 @@
22
21
 
23
22
  <% end %>
24
23
 
25
- <div class="panel-body markdown markdown-toc">
24
+ <div class="card-body markdown markdown-toc">
26
25
  <article>
27
26
  <%= @page.body_html %>
28
27
  </article>
29
28
  </div>
30
29
 
31
- <div class="editors panel-footer clearfix">
30
+ <div class="card-footer editors clearfix">
32
31
  <div class="heading">
33
32
  <%= t("pages.wiki_page_contributors")%>
34
33
  <span class="pull-right"><%= social_share_button_tag h("#{@page.title} via: @#{Setting.twitter_id} ") %></span>
@@ -1,7 +1,7 @@
1
1
  module Homeland
2
2
  module Wiki
3
- NAME = 'wiki'
3
+ NAME = 'wiki'
4
4
  DESCRIPTION = 'Display Wiki channel in navbar for wike pages.'
5
- VERSION = '0.3.0'
5
+ VERSION = '0.4.0'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: homeland-wiki
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Griffin Qiu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-03-21 00:00:00.000000000 Z
12
+ date: 2018-04-18 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -88,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  version: '0'
89
89
  requirements: []
90
90
  rubyforge_project:
91
- rubygems_version: 2.6.11
91
+ rubygems_version: 2.7.6
92
92
  signing_key:
93
93
  specification_version: 4
94
94
  summary: Display Wiki channel in navbar for wike pages.