tawork 0.0.17 → 0.0.18

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTQ5ZTFkNzE4YmE1NTZkYjBmMzllNjY0ZDIyOTYyZjZkNTk3NzE4YQ==
4
+ MDFhYjA3MWViMzVlZmRkMjUwM2Q3N2Y4NWJkYTNiN2E5ZDQyYTJlZA==
5
5
  data.tar.gz: !binary |-
6
- ZDhmZWQ5MTVhYzg0NjU3NTg2N2QzYzVmYTM3NGRiOWY1Y2QwYTM2NA==
6
+ MWZiYmY0NmIyZGZhNWU0ZjE5ZDY5MWViYTAxMmU5MzAyNDZhMmZhNQ==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- M2U1MWU0NzEwODE0YTA4YTQ3ZDIzMzU0ZmViNTNiZDNlOGRhZGZiOGVlNjkx
10
- ZGIzMmRiZmY3OWUxZWMzMjU3MmNlMTY3NTZjMDUyZTBmMDlkYjJmZTYyZDcw
11
- M2E4NzBiODIwMzE5ZGI1MjlkYTZjOThmMWMwMWFiNmNjZDYzNGY=
9
+ ODMzYjRmZTlmOWVjNDlmNjNmOWY5ZDQ2MmVjYzc5MWEwNDJjYzJhMTdlYjJh
10
+ MjJjYTUxMWY5MmZkM2NjZjQ2Mzg5MjBiYmYyZWJjMjI3MDkxMTZjNTcwYzdl
11
+ MmY5M2ZhOWI2M2E0YzUzY2I4MzRmYzFkYWVhMWFjODI5NDVlODc=
12
12
  data.tar.gz: !binary |-
13
- MWZlNWZmZDljNDQ4YWUyY2I3N2ZjZWU1ZTA2ZTk5MjJkN2Q0OGNmZjNkMTQ1
14
- NjlmZjMxZDFhMDVlZDE2ZjkzMjVhMTRiZjc2MWFhZDZmMzBkMWFjYmVkYWRh
15
- ZTcxNWU0ZDk5ZDE3YTc1MDgwMTNjNzJkZTk0ZmNiODU0NGMwYzU=
13
+ YTc3YmZhOThmY2U0ODRjZjZjYTIxYWJmNDFmOTg5MTY1YjA3MjgzYzkzZDUz
14
+ ZDYxMmZmM2VjMDAzNmFlZGY2Yzg5MTA3ZjliYTA2ZjY2Y2UyNDNhMDk4Mjlj
15
+ OWU4YjRhZDUyNzkzMjFlMTBkOTViYTA4MmQ4ZGNlODJhMGI2NTQ=
data/Gemfile CHANGED
@@ -18,6 +18,7 @@ gem 'omniauth-openid'
18
18
  gem 'simple_form'
19
19
  gem 'aasm'
20
20
  gem 'acts_as_list', git: "git@github.com:swanandp/acts_as_list.git"
21
+ gem 'acts-as-taggable-on'
21
22
  gem 'public_activity'
22
23
  gem 'diffy'
23
24
  gem 'gollum-lib'
data/Gemfile.lock CHANGED
@@ -52,6 +52,8 @@ GEM
52
52
  minitest (~> 5.1)
53
53
  thread_safe (~> 0.1)
54
54
  tzinfo (~> 1.1)
55
+ acts-as-taggable-on (3.0.2)
56
+ rails (>= 3, < 5)
55
57
  ancestry (2.0.0)
56
58
  activerecord (>= 3.0.0)
57
59
  ansi (1.4.3)
@@ -311,6 +313,7 @@ PLATFORMS
311
313
  DEPENDENCIES
312
314
  RedCloth
313
315
  aasm
316
+ acts-as-taggable-on
314
317
  acts_as_list!
315
318
  ancestry
316
319
  better_errors
@@ -19,6 +19,7 @@
19
19
  //= require bootstrap-typeahead
20
20
  // require bootstrap-tree
21
21
  //= require bootstrap-tagsinput
22
+ //= require bootstrap-tokenfield
22
23
  //
23
24
  //= require moxie
24
25
  //= require plupload.dev
@@ -3,10 +3,24 @@ class Tawork.Views.PageView extends Backbone.View
3
3
  'click a.star': 'starred'
4
4
 
5
5
  initialize: (options = {}) ->
6
- @page_id = @$el.data("page-id")
6
+ @page_id = page_id = @$el.data("page-id")
7
7
  @initialize_sortable_tree()
8
8
  @setup_uploader()
9
9
  @$("[data-toggle=tooltip]").tooltip()
10
+ @$("#tag_list").tokenfield().on 'tokenfield:createtoken', (e) ->
11
+ $.ajax
12
+ method: "POST"
13
+ url: "/wiki/pages/#{page_id}/add_tag"
14
+ data:
15
+ tag: e.token.value
16
+
17
+ @$("#tag_list").on 'tokenfield:removetoken', (e) ->
18
+ $.ajax
19
+ method: "POST"
20
+ url: "/wiki/pages/#{page_id}/remove_tag"
21
+ data:
22
+ tag: e.token.value
23
+
10
24
 
11
25
  initialize_sortable_tree: ->
12
26
  $self = @
@@ -13,6 +13,7 @@
13
13
  *= require bootflat
14
14
  *= require bootflat-extensions
15
15
  *= require bootflat-square
16
+ *= require bootstrap-tokenfield
16
17
  *= require_tree .
17
18
  */
18
19
 
@@ -241,6 +241,7 @@ li.mjs-nestedSortable-expanded
241
241
  padding-bottom: .25em
242
242
 
243
243
  .last-updated
244
+ text-align: right
244
245
  .user, .time
245
246
  display: inline
246
247
 
@@ -253,3 +254,11 @@ h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6
253
254
  .attachment
254
255
  .actions a
255
256
  margin-right: .5em
257
+
258
+ div.tokenfield.form-control
259
+ border: none
260
+
261
+ &.focus
262
+ border: none
263
+ outline: none
264
+ box-shadow: none
@@ -105,6 +105,18 @@ class Wiki::PagesController < ApplicationController
105
105
  render json: {}
106
106
  end
107
107
 
108
+ def add_tag
109
+ @page.tag_list.add(params[:tag])
110
+ @page.save
111
+ render json: {}
112
+ end
113
+
114
+ def remove_tag
115
+ @page.tag_list.remove(params[:tag])
116
+ @page.save
117
+ render json: {}
118
+ end
119
+
108
120
  protected
109
121
  def load_page
110
122
  @page = Page.find(params[:id]) if params[:id]
data/app/models/page.rb CHANGED
@@ -6,6 +6,7 @@ class Page < ActiveRecord::Base
6
6
 
7
7
  has_ancestry #touch: true
8
8
  acts_as_list scope: [:ancestry]
9
+ acts_as_taggable
9
10
 
10
11
  attr_accessor :old_ancestor_ids
11
12
 
@@ -47,6 +48,8 @@ class Page < ActiveRecord::Base
47
48
  def last_updated
48
49
  activities.
49
50
  where(key: 'page.update_details').
51
+ order("created_at desc").first ||
52
+ activities.where(key: 'page.created').
50
53
  order("created_at desc").first
51
54
  end
52
55
 
@@ -1,7 +1,11 @@
1
1
  .page-article{class: "page_#{@page.id}"}
2
2
  %h3.edit-helper.hide Title
3
3
  %h1#wiki-title.wiki-title= @page.title
4
- = render 'last_updated'
4
+ .meta.row
5
+ .col-md-8
6
+ = render 'tags'
7
+ .col-md-4
8
+ = render 'last_updated'
5
9
 
6
10
  %h3.edit-helper.hide Body
7
11
  #wiki-content.wiki-content.content-description
@@ -21,11 +25,18 @@
21
25
  inline: true
22
26
  toolbar: "undo redo"
23
27
  menubar: false
28
+ setup: (ed) ->
29
+ ed.on 'init', (args) ->
30
+ window.initial_title = tinyMCE.get("wiki-title").getContent()
24
31
 
25
32
  tinymce.init
26
33
  selector: "div.wiki-content"
27
34
  convert_urls: false
28
35
  inline: true
36
+ setup: (ed) ->
37
+ ed.on 'init', (args) ->
38
+ window.initial_body = tinyMCE.get("wiki-content").getContent()
39
+
29
40
  plugins: [
30
41
  "autosave advlist autolink lists link image charmap"
31
42
  "searchreplace code fullscreen mention"
@@ -118,14 +129,27 @@
118
129
  $html = $("<a>", "data-mention": item.type, href: item.url).text(item.name)
119
130
 
120
131
  return $html.get(0).outerHTML
132
+
121
133
  false
122
134
 
123
135
  $(".edit").click ->
124
136
  enable_edit()
125
137
  $(".save").show()
138
+ $(".cancel").show()
126
139
  $(".edit").hide()
127
140
  false
128
141
 
142
+ $(".cancel").click ->
143
+ tinyMCE.execCommand('mceRemoveEditor', true, 'wiki-title')
144
+ tinyMCE.execCommand('mceRemoveEditor', true, 'wiki-content')
145
+ $(".edit-helper").toggleClass("hide")
146
+ $(".save").hide()
147
+ $(".cancel").hide()
148
+ $(".edit").show()
149
+ $("h1.wiki-title").html(window.initial_title)
150
+ $("div.wiki-content").html(window.initial_body)
151
+ false
152
+
129
153
  $(".save").click ->
130
154
  title = tinyMCE.get("wiki-title").getContent()
131
155
  body = tinyMCE.get("wiki-content").getContent()
@@ -1,4 +1,4 @@
1
- .last-updated.pull-right.meta
1
+ .last-updated
2
2
  - if @last_updated
3
3
  %span Last updated by
4
4
  .user= @last_updated.owner.display_name
@@ -2,16 +2,20 @@
2
2
  %li
3
3
  %a.edit{href: "#", data: {toggle: "tooltip", placement: "top"}, title: "Edit"}
4
4
  %i.fa.fa-edit
5
+ %li
6
+ %a.cancel{href: "#", data: {toggle: "tooltip", placement: "top"}, title: "Cancel Edit", style: "display: none;"}
7
+ %i.fa.fa-minus-circle
8
+
5
9
 
10
+ %li
11
+ %a.save{href: "#", data: {type: "PUT", url: wiki_page_path(@page), toggle: "tooltip", placement: "top"}, title: "Save", style: "display: none;"}
12
+ %i.fa.fa-save
6
13
  %li
7
14
  %a.star{href: "#", data: {type: "POST", url: star_wiki_page_path(@page), toggle: "tooltip", placement: "top"}, title: "Star"}
8
15
  - if current_user.starred?(@page)
9
16
  %i.fa.fa-star
10
17
  - else
11
18
  %i.fa.fa-star-o
12
- %li
13
- %a.save{href: "#", data: {type: "PUT", url: wiki_page_path(@page), toggle: "tooltip", placement: "top"}, title: "Save", style: "display: none;"}
14
- %i.fa.fa-save
15
19
  %li
16
20
  = link_to history_wiki_page_path(@page), data: {toggle: "tooltip", placement: "top"}, title: "History" do
17
21
  %i.fa.fa-backward
@@ -0,0 +1,2 @@
1
+ .page-tags
2
+ = text_field_tag :tag_list, @page.tag_list.join(","), placeholder: "add tags"
data/config/routes.rb CHANGED
@@ -23,6 +23,8 @@ Rails.application.class.routes.draw do
23
23
  get :history
24
24
  post :reorder
25
25
  post :star
26
+ post :add_tag
27
+ post :remove_tag
26
28
 
27
29
  post :attach
28
30
  end
@@ -0,0 +1,31 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 1)
2
+ class ActsAsTaggableOnMigration < ActiveRecord::Migration
3
+ def self.up
4
+ create_table :tags do |t|
5
+ t.string :name
6
+ end
7
+
8
+ create_table :taggings do |t|
9
+ t.references :tag
10
+
11
+ # You should make sure that the column created is
12
+ # long enough to store the required class names.
13
+ t.references :taggable, :polymorphic => true
14
+ t.references :tagger, :polymorphic => true
15
+
16
+ # Limit is created to prevent MySQL error on index
17
+ # length for MyISAM table type: http://bit.ly/vgW2Ql
18
+ t.string :context, :limit => 128
19
+
20
+ t.datetime :created_at
21
+ end
22
+
23
+ add_index :taggings, :tag_id
24
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
25
+ end
26
+
27
+ def self.down
28
+ drop_table :taggings
29
+ drop_table :tags
30
+ end
31
+ end
@@ -0,0 +1,22 @@
1
+ # This migration comes from acts_as_taggable_on_engine (originally 2)
2
+ class AddMissingUniqueIndices < ActiveRecord::Migration
3
+
4
+ def self.up
5
+ add_index :tags, :name, unique: true
6
+
7
+ remove_index :taggings, :tag_id
8
+ remove_index :taggings, [:taggable_id, :taggable_type, :context]
9
+ add_index :taggings,
10
+ [:tag_id, :taggable_id, :taggable_type, :context, :tagger_id, :tagger_type],
11
+ unique: true, name: 'taggings_idx'
12
+ end
13
+
14
+ def self.down
15
+ remove_index :tags, :name
16
+
17
+ remove_index :taggings, name: 'tagging_idx'
18
+ add_index :taggings, :tag_id
19
+ add_index :taggings, [:taggable_id, :taggable_type, :context]
20
+ end
21
+
22
+ end
data/db/schema.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  #
12
12
  # It's strongly recommended that you check this file into your version control system.
13
13
 
14
- ActiveRecord::Schema.define(version: 20140313052226) do
14
+ ActiveRecord::Schema.define(version: 20140314014649) do
15
15
 
16
16
  create_table "activities", force: true do |t|
17
17
  t.integer "trackable_id"
@@ -70,7 +70,7 @@ ActiveRecord::Schema.define(version: 20140313052226) do
70
70
  t.string "title"
71
71
  t.text "body"
72
72
  t.integer "creator_id"
73
- t.integer "position", default: 1000
73
+ t.integer "position"
74
74
  t.datetime "created_at"
75
75
  t.datetime "updated_at"
76
76
  end
@@ -98,6 +98,24 @@ ActiveRecord::Schema.define(version: 20140313052226) do
98
98
 
99
99
  add_index "story_details", ["ticket_id"], name: "index_story_details_on_ticket_id", using: :btree
100
100
 
101
+ create_table "taggings", force: true do |t|
102
+ t.integer "tag_id"
103
+ t.integer "taggable_id"
104
+ t.string "taggable_type"
105
+ t.integer "tagger_id"
106
+ t.string "tagger_type"
107
+ t.string "context", limit: 128
108
+ t.datetime "created_at"
109
+ end
110
+
111
+ add_index "taggings", ["tag_id", "taggable_id", "taggable_type", "context", "tagger_id", "tagger_type"], name: "taggings_idx", unique: true, using: :btree
112
+
113
+ create_table "tags", force: true do |t|
114
+ t.string "name"
115
+ end
116
+
117
+ add_index "tags", ["name"], name: "index_tags_on_name", unique: true, using: :btree
118
+
101
119
  create_table "tickets", force: true do |t|
102
120
  t.string "state"
103
121
  t.string "type"
@@ -1,3 +1,3 @@
1
1
  module Tawork
2
- VERSION = '0.0.17'
2
+ VERSION = '0.0.18'
3
3
  end