card 1.16.9 → 1.16.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/db/migrate_core_cards/20120611203506_rails_inflection_updates.rb +3 -1
- data/db/seed/new/card_actions.yml +389 -557
- data/db/seed/new/card_acts.yml +595 -1
- data/db/seed/new/card_changes.yml +22595 -7526
- data/db/seed/new/card_references.yml +379 -407
- data/db/seed/new/cards.yml +1694 -2072
- data/db/seed/test/fixtures/card_actions.yml +966 -1102
- data/db/seed/test/fixtures/card_acts.yml +1017 -399
- data/db/seed/test/fixtures/card_changes.yml +24750 -9681
- data/db/seed/test/fixtures/card_references.yml +603 -631
- data/db/seed/test/fixtures/cards.yml +2293 -2671
- data/lib/card/set.rb +1 -1
- data/mod/01_core/set/all/content.rb +14 -12
- data/mod/03_machines/lib/javascript/wagn_mod.js.coffee +1 -1
- data/mod/05_standard/set/abstract/attachment.rb +9 -9
- data/mod/05_standard/set/all/rich_html/content.rb +115 -103
- data/mod/05_standard/set/type/file.rb +1 -1
- data/tmpsets/set/mod001-01_core/all/active_card.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/collection.rb +3 -3
- data/tmpsets/set/mod001-01_core/all/content.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/erb.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/fetch.rb +169 -93
- data/tmpsets/set/mod001-01_core/all/haml.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/initialize.rb +11 -23
- data/tmpsets/set/mod001-01_core/all/name.rb +130 -80
- data/tmpsets/set/mod001-01_core/all/pattern.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/permissions.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/phases.rb +95 -96
- data/tmpsets/set/mod001-01_core/all/references.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/rules.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/states.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/templating.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/tracked_attributes.rb +85 -60
- data/tmpsets/set/mod001-01_core/all/trash.rb +16 -13
- data/tmpsets/set/mod001-01_core/all/type.rb +5 -25
- data/tmpsets/set/mod001-01_core/all/utils.rb +2 -1
- data/tmpsets/set/mod001-01_core/all/view_cache.rb +2 -1
- data/tmpsets/set/mod002-01_history/all/actions.rb +2 -1
- data/tmpsets/set/mod002-01_history/all/content_history.rb +7 -4
- data/tmpsets/set/mod002-01_history/all/history.rb +119 -83
- data/tmpsets/set/mod003-02_basic_types/all/all_css.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/all/all_csv.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/all/all_js.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/all/base.rb +52 -50
- data/tmpsets/set/mod003-02_basic_types/all/file.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/all/json.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/all/rss.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/all/text.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/type/html.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/type/plain_text.rb +2 -1
- data/tmpsets/set/mod003-02_basic_types/type/pointer.rb +10 -1
- data/tmpsets/set/mod004-03_machines/right/machine_input.rb +2 -1
- data/tmpsets/set/mod004-03_machines/right/machine_output.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/script_ace.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/script_card_menu.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/script_html5shiv_printshiv.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/script_jquery.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/script_jquery_helper.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/script_slot.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/script_tinymce.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/style_bootstrap_compatible.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/style_cards.rb +2 -1
- data/tmpsets/set/mod004-03_machines/self/style_jquery_ui_smoothness.rb +2 -1
- data/tmpsets/set/mod004-03_machines/type/coffee_script.rb +2 -1
- data/tmpsets/set/mod004-03_machines/type/css.rb +2 -1
- data/tmpsets/set/mod004-03_machines/type/java_script.rb +2 -1
- data/tmpsets/set/mod004-03_machines/type/scss.rb +2 -1
- data/tmpsets/set/mod004-03_machines/type/skin.rb +2 -1
- data/tmpsets/set/mod005-04_settings/abstract/permission.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/add_help.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/comment.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/create.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/default.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/delete.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/help.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/read.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/script.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/structure.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/style.rb +2 -1
- data/tmpsets/set/mod005-04_settings/right/update.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/accountable.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/add_help.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/autoname.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/captcha.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/create.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/default.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/delete.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/help.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/input.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/layout.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/on_create.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/on_delete.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/on_update.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/options.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/options_label.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/read.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/recent_settings.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/script.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/structure.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/style.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/table_of_contents.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/thanks.rb +2 -1
- data/tmpsets/set/mod005-04_settings/self/update.rb +2 -1
- data/tmpsets/set/mod005-04_settings/type/setting.rb +2 -1
- data/tmpsets/set/mod006-05_email/all/email_html.rb +2 -1
- data/tmpsets/set/mod006-05_email/all/email_text.rb +2 -1
- data/tmpsets/set/mod006-05_email/all/follow.rb +2 -1
- data/tmpsets/set/mod006-05_email/all/notify.rb +2 -1
- data/tmpsets/set/mod006-05_email/all/observer.rb +2 -1
- data/tmpsets/set/mod006-05_email/right/bcc.rb +2 -1
- data/tmpsets/set/mod006-05_email/right/cc.rb +2 -1
- data/tmpsets/set/mod006-05_email/right/follow.rb +2 -1
- data/tmpsets/set/mod006-05_email/right/follow_fields.rb +2 -1
- data/tmpsets/set/mod006-05_email/right/followers.rb +7 -6
- data/tmpsets/set/mod006-05_email/right/following.rb +3 -2
- data/tmpsets/set/mod006-05_email/right/from.rb +2 -1
- data/tmpsets/set/mod006-05_email/right/html_message.rb +2 -1
- data/tmpsets/set/mod006-05_email/right/to.rb +2 -1
- data/tmpsets/set/mod006-05_email/self/always.rb +2 -1
- data/tmpsets/set/mod006-05_email/self/created.rb +2 -1
- data/tmpsets/set/mod006-05_email/self/edited.rb +2 -1
- data/tmpsets/set/mod006-05_email/self/follow.rb +2 -1
- data/tmpsets/set/mod006-05_email/self/follow_defaults.rb +2 -1
- data/tmpsets/set/mod006-05_email/self/never.rb +2 -1
- data/tmpsets/set/mod006-05_email/type/email_template.rb +2 -1
- data/tmpsets/set/mod006-05_email/type_plus_right/user/follow.rb +3 -2
- data/tmpsets/set/mod007-05_standard/abstract/attachment.rb +22 -9
- data/tmpsets/set/mod007-05_standard/all/account.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/comment.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/error.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/event_viz.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/links.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/rich_html/content.rb +3 -2
- data/tmpsets/set/mod007-05_standard/all/rich_html/editing.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/rich_html/form.rb +23 -12
- data/tmpsets/set/mod007-05_standard/all/rich_html/header.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/rich_html/menu.rb +3 -2
- data/tmpsets/set/mod007-05_standard/all/rich_html/modal.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/rich_html/toolbar.rb +2 -1
- data/tmpsets/set/mod007-05_standard/all/rich_html/wrapper.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/account.rb +7 -6
- data/tmpsets/set/mod007-05_standard/right/discussion.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/email.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/password.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/salt.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/stats.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/status.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/token.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/when_created.rb +2 -1
- data/tmpsets/set/mod007-05_standard/right/when_last_edited.rb +2 -1
- data/tmpsets/set/mod007-05_standard/rstar/rules.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/account_links.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/alerts.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/all.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/foot.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/head.rb +2 -2
- data/tmpsets/set/mod007-05_standard/self/navbox.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/now.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/recent.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/search.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/signin.rb +45 -36
- data/tmpsets/set/mod007-05_standard/self/stats.rb +2 -1
- data/tmpsets/set/mod007-05_standard/self/version.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/basic.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/cardtype.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/date.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/file.rb +11 -3
- data/tmpsets/set/mod007-05_standard/type/image.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/layout_type.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/number.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/phrase.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/search_type.rb +70 -64
- data/tmpsets/set/mod007-05_standard/type/session.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/set.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/signup.rb +96 -64
- data/tmpsets/set/mod007-05_standard/type/toggle.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/uri.rb +2 -1
- data/tmpsets/set/mod007-05_standard/type/user.rb +50 -40
- data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/form.rb +2 -1
- data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/helper.rb +2 -1
- data/tmpsets/set/mod008-06_bootstrap/all/bootstrap/wrapper.rb +2 -1
- data/tmpsets/set/mod008-06_bootstrap/all/rich_bootstrap.rb +2 -1
- data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_cards.rb +2 -1
- data/tmpsets/set/mod008-06_bootstrap/self/bootstrap_js.rb +2 -1
- data/tmpsets/set/mod008-06_bootstrap/self/bootswatch_shared.rb +2 -1
- data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_css.rb +2 -1
- data/tmpsets/set/mod008-06_bootstrap/self/smartmenu_js.rb +2 -1
- metadata +2 -2
data/lib/card/set.rb
CHANGED
@@ -481,7 +481,7 @@ EOF
|
|
481
481
|
|
482
482
|
def attachment name, args
|
483
483
|
include Abstract::Attachment
|
484
|
-
set_specific_attributes name, :load_from_mod, :
|
484
|
+
set_specific_attributes name, :load_from_mod, :action_id_of_cached_upload,
|
485
485
|
"remote_#{name}_url".to_sym
|
486
486
|
uploader_class = args[:uploader] || FileUploader
|
487
487
|
mount_uploader name, uploader_class
|
@@ -1,10 +1,10 @@
|
|
1
1
|
::Card.error_codes[:conflict] = [:conflict, 409]
|
2
2
|
|
3
3
|
def content
|
4
|
-
db_content
|
4
|
+
db_content || (new_card? && template.db_content)
|
5
5
|
end
|
6
6
|
|
7
|
-
def content=
|
7
|
+
def content= value
|
8
8
|
self.db_content = value
|
9
9
|
end
|
10
10
|
|
@@ -13,7 +13,7 @@ def raw_content
|
|
13
13
|
end
|
14
14
|
|
15
15
|
format do
|
16
|
-
def chunk_list #override to customize by set
|
16
|
+
def chunk_list # override to customize by set
|
17
17
|
:default
|
18
18
|
end
|
19
19
|
end
|
@@ -23,11 +23,11 @@ def label
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def creator
|
26
|
-
Card[
|
26
|
+
Card[creator_id]
|
27
27
|
end
|
28
28
|
|
29
29
|
def updater
|
30
|
-
Card[
|
30
|
+
Card[updater_id]
|
31
31
|
end
|
32
32
|
|
33
33
|
def clean_html?
|
@@ -38,25 +38,27 @@ def history?
|
|
38
38
|
false
|
39
39
|
end
|
40
40
|
|
41
|
-
def save_content_draft
|
41
|
+
def save_content_draft _content
|
42
42
|
clear_drafts
|
43
43
|
end
|
44
44
|
|
45
45
|
def clear_drafts
|
46
|
-
drafts.created_by(Card::Auth.current_id).each
|
47
|
-
|
48
|
-
|
46
|
+
drafts.created_by(Card::Auth.current_id).each(&:delete)
|
47
|
+
end
|
48
|
+
|
49
|
+
def last_draft_content
|
50
|
+
drafts.last.card_changes.last.value
|
49
51
|
end
|
50
52
|
|
51
|
-
event :save_draft,
|
53
|
+
event :save_draft,
|
54
|
+
before: :store, on: :update,
|
55
|
+
when: proc { Env.params['draft'] == 'true' } do
|
52
56
|
save_content_draft content
|
53
57
|
abort :success
|
54
58
|
end
|
55
59
|
|
56
|
-
|
57
60
|
event :set_default_content, on: :create, before: :approve do
|
58
61
|
if !db_content_changed? && template && template.db_content.present?
|
59
62
|
self.db_content = template.db_content
|
60
63
|
end
|
61
64
|
end
|
62
|
-
|
@@ -41,7 +41,7 @@ $.extend wagn,
|
|
41
41
|
# for file as a subcard in a form,
|
42
42
|
# excess parameters are inlcuded in the request which cause errors.
|
43
43
|
# only the file, type_id and attachment_card_name are needed
|
44
|
-
# attachment_card_name is the original card name,
|
44
|
+
# attachment_card_name is the original card name,
|
45
45
|
# ex: card[subcards][+logo][image], card[file]
|
46
46
|
$(fileupload).bind 'fileuploadsubmit', (e,data) ->
|
47
47
|
$_this = $(this)
|
@@ -24,7 +24,7 @@ event :upload_attachment, before: :validate_name, on: :save, when: proc { |c| c.
|
|
24
24
|
end
|
25
25
|
|
26
26
|
event :assign_attachment_on_create, after: :prepare, on: :create, when: proc { |c| c.save_preliminary_upload? } do
|
27
|
-
if (action = Card::Action.fetch(@
|
27
|
+
if (action = Card::Action.fetch(@action_id_of_cached_upload))
|
28
28
|
upload_cache_card.selected_action_id = action.id
|
29
29
|
upload_cache_card.select_file_revision
|
30
30
|
assign_attachment upload_cache_card.attachment.file, action.comment
|
@@ -33,7 +33,7 @@ end
|
|
33
33
|
|
34
34
|
event :assign_attachment_on_update, after: :prepare, on: :update,
|
35
35
|
when: proc { |c| c.save_preliminary_upload? } do
|
36
|
-
if (action = Card::Action.fetch(@
|
36
|
+
if (action = Card::Action.fetch(@action_id_of_cached_upload))
|
37
37
|
uploaded_file =
|
38
38
|
with_selected_action_id(action.id) do
|
39
39
|
attachment.file
|
@@ -62,7 +62,7 @@ event :save_original_filename, after: :validate_name, when: proc {|c| !c.prelimi
|
|
62
62
|
end
|
63
63
|
|
64
64
|
event :delete_cached_upload_file_on_create, after: :extend, on: :create, when: proc { |c| c.save_preliminary_upload? } do
|
65
|
-
if (action = Card::Action.fetch(@
|
65
|
+
if (action = Card::Action.fetch(@action_id_of_cached_upload))
|
66
66
|
upload_cache_card.delete_files_for_action action
|
67
67
|
action.delete
|
68
68
|
end
|
@@ -70,7 +70,7 @@ event :delete_cached_upload_file_on_create, after: :extend, on: :create, when: p
|
|
70
70
|
end
|
71
71
|
|
72
72
|
event :delete_cached_upload_file_on_update, after: :extend, on: :update, when: proc { |c| c.save_preliminary_upload? } do
|
73
|
-
if (action = Card::Action.fetch(@
|
73
|
+
if (action = Card::Action.fetch(@action_id_of_cached_upload))
|
74
74
|
delete_files_for_action action
|
75
75
|
action.delete
|
76
76
|
end
|
@@ -99,7 +99,7 @@ def preliminary_upload?
|
|
99
99
|
end
|
100
100
|
|
101
101
|
def save_preliminary_upload?
|
102
|
-
@
|
102
|
+
@action_id_of_cached_upload.present?
|
103
103
|
end
|
104
104
|
|
105
105
|
def attachment_changed?
|
@@ -116,12 +116,12 @@ def upload_cache_card
|
|
116
116
|
end
|
117
117
|
|
118
118
|
# action id of the cached upload
|
119
|
-
def
|
120
|
-
@
|
119
|
+
def action_id_of_cached_upload= value
|
120
|
+
@action_id_of_cached_upload = value
|
121
121
|
end
|
122
122
|
|
123
|
-
def
|
124
|
-
@
|
123
|
+
def action_id_of_cached_upload
|
124
|
+
@action_id_of_cached_upload
|
125
125
|
end
|
126
126
|
|
127
127
|
def load_from_mod= value
|
@@ -3,15 +3,14 @@ def show_comment_box_in_related?
|
|
3
3
|
end
|
4
4
|
|
5
5
|
format :html do
|
6
|
-
|
7
6
|
def show view, args
|
8
7
|
if show_layout?
|
9
8
|
args.merge! view: view if view
|
10
9
|
@main_opts = args
|
11
|
-
|
10
|
+
render :layout
|
12
11
|
else
|
13
12
|
view ||= args[:home_view] || :open
|
14
|
-
@inclusion_opts = args
|
13
|
+
@inclusion_opts = (args[:items] || {}).clone
|
15
14
|
render view, args
|
16
15
|
end
|
17
16
|
end
|
@@ -22,17 +21,17 @@ format :html do
|
|
22
21
|
|
23
22
|
view :layout, perms: :none do |args|
|
24
23
|
output [
|
25
|
-
process_content(get_layout_content, content_opts:
|
24
|
+
process_content(get_layout_content, content_opts:
|
25
|
+
{ chunk_list: :references }),
|
26
26
|
_render_modal_slot(args)
|
27
27
|
]
|
28
28
|
end
|
29
29
|
|
30
|
-
|
31
30
|
view :content do |args|
|
32
31
|
wrap args.reverse_merge(slot_class: 'card-content') do
|
33
32
|
[
|
34
|
-
_optional_render(
|
35
|
-
_render_core(
|
33
|
+
_optional_render(:menu, args, :hide),
|
34
|
+
_render_core(args)
|
36
35
|
]
|
37
36
|
end
|
38
37
|
end
|
@@ -41,9 +40,9 @@ format :html do
|
|
41
40
|
wrap args.reverse_merge(slot_class: 'card-content panel panel-default') do
|
42
41
|
wrap_with :div, class: 'panel-body' do
|
43
42
|
[
|
44
|
-
_optional_render(
|
45
|
-
_render_core(
|
46
|
-
|
43
|
+
_optional_render(:menu, args, :hide),
|
44
|
+
_render_core(args)
|
45
|
+
] * "\n"
|
47
46
|
end
|
48
47
|
end
|
49
48
|
end
|
@@ -51,10 +50,10 @@ format :html do
|
|
51
50
|
view :titled, tags: :comment do |args|
|
52
51
|
wrap args do
|
53
52
|
[
|
54
|
-
_optional_render(
|
55
|
-
_render_header(
|
56
|
-
wrap_body(
|
57
|
-
optional_render(
|
53
|
+
_optional_render(:menu, args),
|
54
|
+
_render_header(args),
|
55
|
+
wrap_body(content: true) { _render_core args },
|
56
|
+
optional_render(:comment_box, args)
|
58
57
|
]
|
59
58
|
end
|
60
59
|
end
|
@@ -62,9 +61,9 @@ format :html do
|
|
62
61
|
view :labeled do |args|
|
63
62
|
wrap args do
|
64
63
|
[
|
65
|
-
_optional_render(
|
66
|
-
"<label>#{
|
67
|
-
wrap_body(
|
64
|
+
_optional_render(:menu, args),
|
65
|
+
"<label>#{_render_title args}</label>",
|
66
|
+
wrap_body(body_class: 'closed-content', content: true) do
|
68
67
|
_render_closed_content args
|
69
68
|
end
|
70
69
|
]
|
@@ -73,23 +72,23 @@ format :html do
|
|
73
72
|
|
74
73
|
view :title do |args|
|
75
74
|
title = fancy_title args[:title], args[:title_class]
|
76
|
-
title =
|
77
|
-
|
78
|
-
|
75
|
+
title =
|
76
|
+
_optional_render(:title_editable, args, :hide) ||
|
77
|
+
_optional_render(:title_link, args.merge(title_ready: title), :hide) ||
|
78
|
+
title
|
79
79
|
add_name_context
|
80
80
|
title
|
81
81
|
end
|
82
82
|
|
83
83
|
view :title_link do |args|
|
84
|
-
|
84
|
+
title_text = args[:title_ready] || showname(args[:title])
|
85
|
+
card_link card.cardname, text: title_text
|
85
86
|
end
|
86
87
|
|
87
|
-
view :type_info do
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
</span>
|
92
|
-
}.html_safe
|
88
|
+
view :type_info do
|
89
|
+
link_args = { text: "#{card.type_name}", class: 'navbar-link' }
|
90
|
+
link = card_link card.type_name, link_args
|
91
|
+
%{<span class="type-info pull-right">#{link}</span>}.html_safe
|
93
92
|
end
|
94
93
|
|
95
94
|
view :title_editable do |args|
|
@@ -98,145 +97,158 @@ format :html do
|
|
98
97
|
end
|
99
98
|
res = links.shift
|
100
99
|
links.each_with_index do |link, index|
|
101
|
-
|
100
|
+
name = card.cardname.parts[0..index + 1].join '+'
|
101
|
+
res += card_link name, text: glyphicon('plus', 'header-icon')
|
102
102
|
res += link
|
103
103
|
end
|
104
104
|
res += ' '
|
105
|
-
res.concat view_link(
|
106
|
-
|
105
|
+
res.concat view_link(
|
106
|
+
glyphicon('edit', 'header-icon'),
|
107
|
+
:edit_name,
|
108
|
+
class: 'slotter', 'data-toggle' => 'tooltip', title: 'edit name'
|
109
|
+
)
|
110
|
+
res.concat _optional_render(:type_link, args, :show)
|
107
111
|
end
|
108
112
|
|
109
113
|
view :open, tags: :comment do |args|
|
110
114
|
args[:optional_toggle] ||= main? ? :hide : :show
|
111
115
|
frame args.merge(content: true) do
|
112
116
|
[
|
113
|
-
_render_open_content(
|
114
|
-
optional_render(
|
117
|
+
_render_open_content(args),
|
118
|
+
optional_render(:comment_box, args)
|
115
119
|
]
|
116
120
|
end
|
117
121
|
end
|
118
122
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
view :anchor, perms: :none, tags: :unknown_ok do |args|
|
123
|
-
%{ <a id="#{card.cardname.url_key}" name="#{card.cardname.url_key}"></a> }
|
124
|
-
end
|
125
|
-
=end
|
123
|
+
# view :anchor, perms: :none, tags: :unknown_ok do |args|
|
124
|
+
# %{ <a id="#{card.cardname.url_key}" name="#{card.cardname.url_key}"></a> }
|
125
|
+
# end
|
126
126
|
|
127
127
|
view :type do |args|
|
128
128
|
klasses = ['cardtype']
|
129
|
-
klass = args[:type_class]
|
129
|
+
klass = args[:type_class]
|
130
|
+
klasses << klass if klass
|
130
131
|
card_link card.type_card.name, class: klasses
|
131
132
|
end
|
132
133
|
|
133
134
|
view :closed do |args|
|
134
|
-
frame args.reverse_merge(
|
135
|
+
frame args.reverse_merge(
|
136
|
+
content: true,
|
137
|
+
body_class: 'closed-content',
|
138
|
+
toggle_mode: :close,
|
139
|
+
optional_toggle: :show,
|
140
|
+
optional_toolbar: :hide
|
141
|
+
) do
|
135
142
|
_optional_render :closed_content, args
|
136
143
|
end
|
137
144
|
end
|
138
145
|
|
139
|
-
|
140
146
|
view :change do |args|
|
141
147
|
args[:optional_title_link] = :show
|
142
148
|
wrap args do
|
143
149
|
[
|
144
|
-
_optional_render(
|
145
|
-
_optional_render(
|
146
|
-
_optional_render(
|
150
|
+
_optional_render(:title, args),
|
151
|
+
_optional_render(:menu, args, :hide),
|
152
|
+
_optional_render(:last_action, args)
|
147
153
|
]
|
148
154
|
end
|
149
155
|
end
|
150
156
|
|
151
157
|
def current_set_card
|
152
158
|
set_name = params[:current_set]
|
153
|
-
|
159
|
+
if card.known? && card.type_id == Card::CardtypeID
|
160
|
+
set_name ||= "#{card.name}+*type"
|
161
|
+
end
|
154
162
|
set_name ||= "#{card.name}+*self"
|
155
163
|
Card.fetch(set_name)
|
156
164
|
end
|
157
165
|
|
158
|
-
|
159
166
|
view :related do |args|
|
160
167
|
if args[:related_card]
|
161
168
|
frame args.merge(optional_toolbar: :show) do
|
162
|
-
nest(
|
169
|
+
nest(args[:related_card], args[:related_args])
|
163
170
|
end
|
164
171
|
end
|
165
172
|
end
|
166
173
|
|
167
174
|
def default_related_args args
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
#subheader = with_name_context(card.name) { showname rcard.name }
|
175
|
-
subheader = with_name_context(card.name) { subformat(rcard)._render_title(args) }
|
176
|
-
add_name_context card.name
|
177
|
-
nest_args = ( rparams[:slot] || {} ).deep_symbolize_keys.reverse_merge(
|
178
|
-
view: ( rparams[:view] || :open ),
|
179
|
-
optional_header: :hide,
|
180
|
-
optional_menu: :show,
|
181
|
-
subheader: subheader,
|
182
|
-
optional_toggle: :hide,
|
183
|
-
optional_help: :show,
|
184
|
-
parent: card,
|
185
|
-
subframe: true,
|
186
|
-
subslot: true
|
187
|
-
)
|
188
|
-
nest_args[:optional_comment_box] = :show if rcard.show_comment_box_in_related?
|
175
|
+
rparams = args[:related] || params[:related]
|
176
|
+
return unless rparams
|
177
|
+
rcard = rparams[:card] || begin
|
178
|
+
rcardname = rparams[:name].to_name.to_absolute_name(card.cardname)
|
179
|
+
Card.fetch rcardname, new: {}
|
180
|
+
end
|
189
181
|
|
190
|
-
|
191
|
-
args
|
182
|
+
subheader = with_name_context(card.name) do
|
183
|
+
subformat(rcard)._render_title(args)
|
192
184
|
end
|
185
|
+
add_name_context card.name
|
186
|
+
nest_args = (rparams[:slot] || {}).deep_symbolize_keys.reverse_merge(
|
187
|
+
view: (rparams[:view] || :open),
|
188
|
+
optional_header: :hide,
|
189
|
+
optional_menu: :show,
|
190
|
+
subheader: subheader,
|
191
|
+
optional_toggle: :hide,
|
192
|
+
optional_help: :show,
|
193
|
+
parent: card,
|
194
|
+
subframe: true,
|
195
|
+
subslot: true
|
196
|
+
)
|
197
|
+
if rcard.show_comment_box_in_related?
|
198
|
+
nest_args[:optional_comment_box] = :show
|
199
|
+
end
|
200
|
+
args[:related_args] = nest_args
|
201
|
+
args[:related_card] = rcard
|
193
202
|
end
|
194
203
|
|
195
|
-
|
196
|
-
|
197
204
|
view :help, tags: :unknown_ok do |args|
|
198
|
-
text =
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
if help_card = card.rule_card( *setting ) and help_card.ok? :read
|
205
|
+
text = args[:help_text] || begin
|
206
|
+
setting = card.new_card? ? [:add_help, { fallback: :help }] : :help
|
207
|
+
help_card = card.rule_card(*setting)
|
208
|
+
if help_card && help_card.ok?(:read)
|
203
209
|
with_inclusion_mode :normal do
|
204
|
-
|
205
|
-
|
210
|
+
raw_help_content = _render_raw args.merge(structure: help_card.name)
|
211
|
+
process_content raw_help_content, content_opts:
|
212
|
+
{ chunk_list: :references }
|
213
|
+
# render help card with current card's format
|
214
|
+
# so current card's context is used in help card inclusions
|
206
215
|
end
|
207
216
|
end
|
208
217
|
end
|
209
|
-
klass = [args[:help_class], 'help-text'].compact*' '
|
218
|
+
klass = [args[:help_class], 'help-text'].compact * ' '
|
210
219
|
%{<div class="#{klass}">#{raw text}</div>} if text
|
211
220
|
end
|
212
221
|
|
222
|
+
view :last_action do
|
223
|
+
act = card.last_act
|
224
|
+
return unless act
|
225
|
+
action = act.action_on card.id
|
226
|
+
return unless action
|
227
|
+
action_verb =
|
228
|
+
case action.action_type
|
229
|
+
when :create then 'added'
|
230
|
+
when :delete then 'deleted'
|
231
|
+
else
|
232
|
+
link_to(
|
233
|
+
'edited',
|
234
|
+
path(view: :history),
|
235
|
+
class: 'last-edited', rel: 'nofollow'
|
236
|
+
)
|
237
|
+
end
|
213
238
|
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
else
|
221
|
-
link_to('edited', path(view: :history), class: 'last-edited', rel: 'nofollow')
|
222
|
-
end
|
223
|
-
|
224
|
-
%{
|
225
|
-
<span class="last-update">
|
226
|
-
#{ action_verb }
|
227
|
-
#{ _render_acted_at }
|
228
|
-
ago by
|
229
|
-
#{ subformat(card.last_actor)._render_link }
|
230
|
-
</span>
|
231
|
-
}
|
232
|
-
end
|
239
|
+
%{
|
240
|
+
<span class="last-update">
|
241
|
+
#{action_verb} #{_render_acted_at} ago by
|
242
|
+
#{subformat(card.last_actor)._render_link}
|
243
|
+
</span>
|
244
|
+
}
|
233
245
|
end
|
234
246
|
|
235
247
|
private
|
236
248
|
|
237
249
|
def fancy_title title=nil, title_class=nil
|
238
|
-
|
250
|
+
klasses = ['card-title', title_class].compact * ' '
|
251
|
+
title = showname(title).to_name.parts.join %{<span class="joint">+</span>}
|
252
|
+
raw %{<span class="#{klasses}">#{title}</span>}
|
239
253
|
end
|
240
254
|
end
|
241
|
-
|
242
|
-
|