card 1.20.4 → 1.21.0
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/card.gemspec +9 -9
- data/db/migrate_core_cards/20170515101262_add_advanced_edit_cards.rb +20 -0
- data/db/migrate_core_cards/20170608083819_add_full_width_layout_card.rb +23 -0
- data/db/migrate_core_cards/20170608200649_add_input_options_codename.rb +8 -0
- data/db/seed/new/card_actions.yml +783 -791
- data/db/seed/new/card_acts.yml +65 -47
- data/db/seed/new/card_changes.yml +3198 -3177
- data/db/seed/new/card_references.yml +604 -534
- data/db/seed/new/cards.yml +2355 -2256
- data/db/seed/test/fixtures/card_actions.yml +1795 -1803
- data/db/seed/test/fixtures/card_acts.yml +264 -246
- data/db/seed/test/fixtures/card_changes.yml +6275 -6184
- data/db/seed/test/fixtures/card_references.yml +1305 -1263
- data/db/seed/test/fixtures/cards.yml +3393 -3298
- data/db/seed/test/seed.rb +2 -2
- data/db/version_core_cards.txt +1 -1
- data/lib/card.rb +4 -0
- data/lib/card/act_manager/subdirector_array.rb +1 -0
- data/lib/card/auth/current.rb +7 -3
- data/lib/card/env.rb +5 -0
- data/lib/card/env/success.rb +1 -1
- data/lib/card/format/names.rb +3 -13
- data/lib/card/model/save_helper.rb +4 -6
- data/lib/card/query.rb +2 -1
- data/lib/card/query/attributes.rb +34 -14
- data/lib/card/query/value.rb +3 -4
- data/lib/card/set/format.rb +29 -4
- data/lib/card/set/format/haml_views.rb +25 -13
- data/lib/card/set/trait.rb +1 -0
- data/lib/card/set_pattern.rb +17 -1
- data/lib/card/subcards.rb +3 -2
- data/lib/generators/card/format/format_generator.rb +2 -0
- data/lib/generators/card/set/set_generator.rb +2 -0
- data/lib/generators/card/template/USAGE +10 -0
- data/lib/generators/card/template/template_generator.rb +46 -0
- data/lib/generators/card/template/templates/haml_template.erb +1 -0
- data/mod/Modfile +1 -1
- data/mod/account/set/all/account.rb +9 -5
- data/mod/account/set/right/account.rb +17 -5
- data/mod/account/set/self/account_links.rb +1 -2
- data/mod/account/set/type/signup.rb +4 -5
- data/mod/account/set/type/user.rb +1 -1
- data/mod/account/spec/set/all/account_spec.rb +2 -2
- data/mod/account/spec/set/right/account_spec.rb +2 -2
- data/mod/account/spec/set/right/email_spec.rb +1 -1
- data/mod/account/spec/set/right/password_spec.rb +1 -1
- data/mod/account/spec/set/self/signin_spec.rb +2 -2
- data/mod/account/spec/set/type/signup_spec.rb +4 -0
- data/mod/ace_editor/set/abstract/ace_editor.rb +6 -3
- data/mod/ace_editor/set/self/script_ace.rb +1 -0
- data/mod/admin/set/self/admin.rb +1 -1
- data/mod/admin/set/self/version.rb +1 -0
- data/mod/basic_formats/format/css_format.rb +1 -0
- data/mod/basic_formats/format/csv_format.rb +1 -0
- data/mod/basic_formats/format/file_format.rb +1 -0
- data/mod/basic_formats/format/js_format.rb +1 -0
- data/mod/basic_formats/format/json_format.rb +1 -0
- data/mod/basic_formats/format/rss_format.rb +1 -0
- data/mod/basic_formats/format/xml_format.rb +1 -0
- data/mod/basic_formats/set/all/all_csv.rb +1 -1
- data/mod/basic_formats/set/all/base.rb +11 -3
- data/mod/basic_formats/set/all/json.rb +50 -8
- data/mod/basic_formats/set/all/rss.rb +21 -7
- data/mod/basic_formats/set/self/01_head/javascript.rb +1 -1
- data/mod/basic_formats/set/self/head.rb +1 -1
- data/mod/basic_formats/spec/set/all/base_spec.rb +13 -0
- data/mod/basic_types/set/type/html.rb +6 -2
- data/mod/basic_types/set/type/plain_text.rb +2 -3
- data/mod/bootstrap/lib/bootstrap.rb +2 -2
- data/mod/bootstrap/lib/bootstrap/basic_tags.rb +1 -1
- data/mod/bootstrap/lib/bootstrap/component.rb +2 -3
- data/mod/bootstrap/lib/bootstrap/component/form.rb +6 -5
- data/mod/bootstrap/lib/bootstrap/component/horizontal_form.rb +1 -1
- data/mod/bootstrap/lib/bootstrap/component/layout.rb +3 -3
- data/mod/bootstrap/lib/bootstrap/component_loader.rb +0 -2
- data/mod/bootstrap/lib/bootstrap/delegate.rb +2 -2
- data/mod/bootstrap/lib/bootstrapper.rb +1 -1
- data/mod/bootstrap/set/all/bootstrap/accordion.rb +1 -1
- data/mod/bootstrap/set/all/bootstrap/form.rb +2 -2
- data/mod/bootstrap/set/all/bootstrap/helper.rb +1 -0
- data/mod/bootstrap/set/all/bootstrap/wrapper.rb +1 -1
- data/mod/bootstrap/set/self/bootstrap_js.rb +1 -1
- data/mod/bootstrap/set/self/bootswatch_shared.rb +6 -6
- data/mod/bootstrap/set/self/script_mods.rb +1 -1
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_builder_spec.rb +7 -6
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_spec.rb +2 -1
- data/mod/bootstrap/spec/set/all/bootstrap/form_spec.rb +6 -3
- data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +3 -2
- data/mod/carrierwave/set/abstract/attachment.rb +1 -3
- data/mod/carrierwave/set/abstract/attachment/paths.rb +1 -1
- data/mod/carrierwave/set/abstract/attachment/storage_type.rb +11 -1
- data/mod/carrierwave/set/type/file.rb +3 -3
- data/mod/carrierwave/spec/lib/carrier_wave/file_card_uploader_spec.rb +3 -0
- data/mod/carrierwave/spec/set/type/file_spec.rb +24 -6
- data/mod/carrierwave/spec/set/type/image_spec.rb +3 -0
- data/mod/core/chunk/link.rb +1 -1
- data/mod/core/chunk/nest.rb +2 -1
- data/mod/core/chunk/query_reference.rb +1 -1
- data/mod/core/chunk/reference.rb +1 -0
- data/mod/core/chunk/uri.rb +4 -3
- data/mod/core/set/abstract/lock.rb +26 -0
- data/mod/core/set/all/assign_attributes.rb +8 -4
- data/mod/core/set/all/collection.rb +16 -7
- data/mod/core/set/all/content.rb +6 -0
- data/mod/core/set/all/event.rb +1 -1
- data/mod/core/set/all/fetch.rb +2 -2
- data/mod/core/set/all/haml.rb +5 -15
- data/mod/core/set/all/initialize.rb +2 -2
- data/mod/core/set/all/name.rb +1 -1
- data/mod/core/set/all/permissions.rb +28 -16
- data/mod/core/set/all/rules.rb +1 -2
- data/mod/core/set/all/subcards.rb +3 -3
- data/mod/core/set/all/templating.rb +5 -1
- data/mod/core/set/all/trash.rb +1 -1
- data/mod/core/set/all/utils.rb +1 -1
- data/mod/core/spec/set/all/actify_spec.rb +1 -1
- data/mod/core/spec/set/all/assign_attributes_spec.rb +2 -2
- data/mod/core/spec/set/all/collection_spec.rb +6 -3
- data/mod/core/spec/set/all/export_spec.rb +40 -112
- data/mod/core/spec/set/all/name_spec.rb +1 -1
- data/mod/core/spec/set/all/permissions_spec.rb +7 -7
- data/mod/core/spec/set/all/rules2_spec.rb +25 -25
- data/mod/core/spec/set/all/rules_spec.rb +2 -7
- data/mod/developer/set/all/event_viz.rb +1 -1
- data/mod/developer/set/right/debug.rb +1 -1
- data/mod/history/lib/card/act.rb +1 -0
- data/mod/history/lib/card/act/act_renderer.rb +23 -20
- data/mod/history/lib/card/act/act_renderer/absolute_act_renderer.rb +0 -1
- data/mod/history/lib/card/act/act_renderer/relative_act_renderer.rb +1 -0
- data/mod/history/lib/card/action.rb +1 -1
- data/mod/history/lib/card/action/action_renderer.rb +2 -2
- data/mod/history/lib/card/change.rb +2 -1
- data/mod/history/set/all/action_view.rb +1 -1
- data/mod/history/set/all/content_history.rb +7 -4
- data/mod/history/set/all/history.rb +6 -6
- data/mod/machines/file/all_script_machine_output/file.js +50 -34
- data/mod/machines/file/all_style_machine_output/file.css +1 -1
- data/mod/machines/lib/javascript/wagn.js.coffee +29 -18
- data/mod/machines/lib/javascript/wagn_layout.js.coffee +7 -3
- data/mod/machines/lib/stylesheets/style_cards.scss +10 -10
- data/mod/machines/set/abstract/machine.rb +5 -28
- data/mod/machines/set/abstract/script.rb +7 -4
- data/mod/machines/set/all/reset_machines.rb +1 -1
- data/mod/machines/set/self/script_jquery_helper.rb +2 -2
- data/mod/machines/set/self/script_slot.rb +1 -1
- data/mod/machines/set/type/coffee_script.rb +3 -2
- data/mod/machines/set/type/css.rb +7 -3
- data/mod/machines/set/type/scss.rb +7 -1
- data/mod/machines/spec/set/type/coffeescript_spec.rb +1 -1
- data/mod/machines/spec/set/type/javascript_spec.rb +1 -1
- data/mod/machines/spec/set/type/scss_spec.rb +3 -2
- data/mod/machines/spec/set/type/skin_spec.rb +1 -1
- data/mod/machines/spec/shared_examples/machine.rb +5 -3
- data/mod/machines/spec/shared_examples/machine_input.rb +1 -0
- data/mod/notifications/format/email_html_format.rb +1 -0
- data/mod/notifications/set/all/follow.rb +1 -1
- data/mod/notifications/set/all/observer.rb +1 -1
- data/mod/notifications/set/all/send_notifications.rb +2 -2
- data/mod/notifications/set/self/follow_defaults.rb +3 -8
- data/mod/notifications/set/type/email_template/email_config.rb +2 -2
- data/mod/notifications/set/type_plus_right/user/follow.rb +2 -2
- data/mod/notifications/spec/set/all/follow_spec.rb +7 -0
- data/mod/notifications/spec/set/all/notify_spec.rb +3 -0
- data/mod/notifications/spec/set/all/observer_spec.rb +1 -1
- data/mod/notifications/spec/set/right/followers_spec.rb +1 -0
- data/mod/pointer/set/abstract/00_paging_params.rb +11 -0
- data/mod/pointer/set/abstract/{00_paging.rb → 01_paging.rb} +10 -6
- data/mod/pointer/set/abstract/{00_paging → 01_paging}/paging_links.rb +0 -0
- data/mod/pointer/set/abstract/{01_pointer.rb → 02_pointer.rb} +26 -5
- data/mod/pointer/set/abstract/{01_pointer → 02_pointer}/edit.rb +3 -5
- data/mod/pointer/set/self/input_options.rb +12 -0
- data/mod/pointer/spec/set/self/input_options_spec.rb +8 -0
- data/mod/pointer/spec/set/type/pointer_spec.rb +3 -2
- data/mod/prosemirror_editor/set/abstract/prosemirror_editor.rb +1 -1
- data/mod/prosemirror_editor/set/self/script_prosemirror.rb +1 -0
- data/mod/settings/lib/card/setting.rb +1 -2
- data/mod/settings/set/abstract/permission.rb +1 -1
- data/mod/settings/set/self/add_help.rb +1 -1
- data/mod/settings/set/self/autoname.rb +1 -1
- data/mod/settings/set/self/csv_structure.rb +2 -0
- data/mod/settings/set/self/help.rb +1 -1
- data/mod/settings/set/self/input.rb +1 -2
- data/mod/settings/set/self/options.rb +2 -2
- data/mod/settings/set/self/options_label.rb +2 -2
- data/mod/settings/set/type/setting.rb +1 -1
- data/mod/settings/spec/set/right/script_spec.rb +1 -1
- data/mod/settings/spec/set/right/style_spec.rb +1 -1
- data/mod/solid_cache/set/abstract/solid_cache.rb +5 -3
- data/mod/solid_cache/spec/set/abstract/solid_cache_spec.rb +4 -3
- data/mod/standard/set/abstract/01_search_params.rb +4 -3
- data/mod/standard/set/abstract/search.rb +2 -1
- data/mod/standard/set/abstract/toolbar_split_button.rb +22 -0
- data/mod/standard/set/all/links.rb +3 -3
- data/mod/standard/set/all/rich_html/classy.rb +37 -0
- data/mod/standard/set/all/rich_html/editing.rb +6 -2
- data/mod/standard/set/all/rich_html/editor.rb +50 -0
- data/mod/standard/set/all/rich_html/form.rb +19 -12
- data/mod/standard/set/all/rich_html/form_elements.rb +2 -2
- data/mod/standard/set/all/rich_html/formgroup.rb +2 -1
- data/mod/standard/set/all/rich_html/header.rb +2 -27
- data/mod/standard/set/all/rich_html/menu.rb +1 -1
- data/mod/standard/set/all/rich_html/new.rb +5 -1
- data/mod/standard/set/all/rich_html/toolbar.rb +15 -60
- data/mod/standard/set/all/rich_html/wrapper.rb +6 -3
- data/mod/standard/set/right/when_created.rb +2 -2
- data/mod/standard/set/rstar/rules_editor.rb +10 -7
- data/mod/standard/set/self/activity_toolbar_button.rb +14 -0
- data/mod/standard/set/self/recent.rb +7 -2
- data/mod/standard/set/self/rules_toolbar_button.rb +42 -0
- data/mod/standard/set/self/search.rb +19 -6
- data/mod/standard/set/type/basic.rb +6 -6
- data/mod/standard/set/type/cardtype.rb +7 -3
- data/mod/standard/set/type/date.rb +2 -4
- data/mod/standard/set/type/layout_type.rb +1 -0
- data/mod/standard/set/type/list.rb +1 -1
- data/mod/standard/set/type/listed_by.rb +1 -2
- data/mod/standard/set/type/number.rb +4 -2
- data/mod/standard/set/type/phrase.rb +4 -2
- data/mod/standard/set/type/search_type.rb +11 -3
- data/mod/standard/set/type/set.rb +8 -8
- data/mod/standard/set/type/toggle.rb +1 -3
- data/mod/standard/set/type/uri.rb +6 -2
- data/mod/standard/spec/chunk/include_spec.rb +3 -2
- data/mod/standard/spec/chunk/query_reference_spec.rb +2 -2
- data/mod/standard/spec/set/all/history_spec.rb +1 -0
- data/mod/standard/spec/set/all/links_spec.rb +1 -0
- data/mod/standard/spec/set/all/rich_html/toolbar_spec.rb +2 -0
- data/mod/standard/spec/set/self/activity_toolbar_button_spec.rb +22 -0
- data/mod/standard/spec/set/type/email_template/email_config_spec.rb +10 -8
- data/mod/standard/spec/set/type/email_template_spec.rb +1 -0
- data/mod/standard/spec/set/type/list_spec.rb +2 -0
- data/mod/standard/spec/set/type/listed_by_spec.rb +5 -0
- data/mod/standard/spec/set/type/search_type_spec.rb +1 -1
- data/mod/standard/spec/set/type/toggle_spec.rb +1 -2
- data/mod/standard/spec/set/type/uri_spec.rb +0 -1
- data/mod/tinymce_editor/db/migrate_cards/20160804112560_add_tinymce_cards.rb +3 -1
- data/mod/tinymce_editor/set/abstract/tinymce_editor.rb +1 -1
- data/mod/tinymce_editor/set/self/script_tinymce.rb +1 -0
- data/mod/twitter/db/migrate_cards/20170305112346_add_twitter_cards.rb +1 -1
- data/mod/twitter/set/type/twitter_template.rb +1 -1
- data/spec/lib/card/format_spec.rb +26 -7
- data/spec/lib/card/loader_spec.rb +96 -35
- data/spec/lib/card/query_spec.rb +0 -1
- data/spec/support/card_spec_loader.rb +1 -0
- data/spec/support/helper/card_helper.rb +0 -36
- data/spec/support/helper/set_helper.rb +80 -0
- data/spec/support/matchers.rb +74 -0
- data/tmpsets/set/mod001-core/all/actify.rb +5 -6
- data/tmpsets/set/mod001-core/all/fetch.rb +14 -12
- data/tmpsets/set/mod001-core/all/name.rb +1 -1
- data/tmpsets/set/mod001-core/all/permissions.rb +12 -22
- data/tmpsets/set/mod001-core/all/tracked_attributes.rb +76 -0
- data/tmpsets/set/mod001-core/all/utils.rb +40 -3
- data/tmpsets/set/mod002-history/all/history.rb +1 -2
- data/tmpsets/set/mod008-solid_cache/abstract/solid_cache.rb +1 -1
- data/tmpsets/set/mod013-carrierwave/abstract/attachment.rb +282 -0
- data/tmpsets/set/mod013-carrierwave/type/file.rb +155 -0
- data/tmpsets/set/mod013-carrierwave/type/image.rb +96 -0
- data/tmpsets/set/mod014-admin/self/admin.rb +113 -0
- data/tmpsets/set/mod014-admin/self/admin_info.rb +110 -0
- data/tmpsets/set/mod014-admin/self/version.rb +15 -0
- data/tmpsets/set/mod015-developer/all/event_viz.rb +59 -0
- data/tmpsets/set/mod015-developer/all/view_viz.rb +30 -0
- data/tmpsets/set/mod015-developer/right/debug.rb +96 -0
- metadata +52 -22
@@ -0,0 +1,46 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
require "generators/card"
|
4
|
+
|
5
|
+
class Card
|
6
|
+
module Generators
|
7
|
+
# A wagn generator that creates a haml template for a view.
|
8
|
+
# Run "wagn generate card:template" to get usage information.
|
9
|
+
class TemplateGenerator < NamedBase
|
10
|
+
source_root File.expand_path("../templates", __FILE__)
|
11
|
+
|
12
|
+
argument :set_pattern, required: true
|
13
|
+
argument :anchors, required: true, type: :array
|
14
|
+
class_option "core", type: :boolean, aliases: "-c",
|
15
|
+
default: false, group: :runtime,
|
16
|
+
desc: "create haml template in Card gem"
|
17
|
+
|
18
|
+
def create_files
|
19
|
+
with_valid_arguments do
|
20
|
+
template "haml_template.erb", set_path
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def with_valid_arguments
|
27
|
+
if !Dir.exist? mod_path
|
28
|
+
warn "invalid mod name: #{file_name}. Directory #{mod_path} doesn't exist."
|
29
|
+
# Card.set_patterns not loaded at this point
|
30
|
+
elsif !%w[self type type_plus_right ltype_rtype rstar star
|
31
|
+
type all_plus all].include? set_pattern
|
32
|
+
warn "invalid set pattern: #{set_pattern}"
|
33
|
+
else
|
34
|
+
yield
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def set_path
|
39
|
+
filename = "#{anchors.last}.haml"
|
40
|
+
dirs = anchors[0..-2]
|
41
|
+
path_parts = [mod_path, "template", set_pattern, dirs, filename]
|
42
|
+
File.join(*path_parts.compact)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
|
data/mod/Modfile
CHANGED
@@ -17,10 +17,11 @@ def parties
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def among? ok_ids
|
20
|
-
ok_ids.
|
21
|
-
|
20
|
+
ok_ids.any? do |ok_id|
|
21
|
+
ok_id == Card::AnyoneID ||
|
22
|
+
(ok_id == Card::AnyoneWithRoleID && all_roles.size > 1) ||
|
23
|
+
parties.member?(ok_id)
|
22
24
|
end
|
23
|
-
ok_ids.member? Card::AnyoneID
|
24
25
|
end
|
25
26
|
|
26
27
|
def own_account?
|
@@ -48,10 +49,13 @@ def all_roles
|
|
48
49
|
end
|
49
50
|
|
50
51
|
def fetch_roles
|
52
|
+
[Card::AnyoneSignedInID] + role_ids_from_roles_trait
|
53
|
+
end
|
54
|
+
|
55
|
+
def role_ids_from_roles_trait
|
51
56
|
Auth.as_bot do
|
52
57
|
role_trait = fetch trait: :roles
|
53
|
-
|
54
|
-
[Card::AnyoneSignedInID] + role_trait.item_ids
|
58
|
+
role_trait ? role_trait.item_ids : []
|
55
59
|
end
|
56
60
|
end
|
57
61
|
|
@@ -57,12 +57,27 @@ end
|
|
57
57
|
|
58
58
|
format :html do
|
59
59
|
view :raw do
|
60
|
+
# FIXME: use field_nest instead of parsing content
|
61
|
+
# Problem: whey you do that then the fields are missing in the sign up form
|
62
|
+
# output(
|
63
|
+
# [
|
64
|
+
# field_nest(:email, view: :titled, title: "email"),
|
65
|
+
# field_nest(:password, view: :titled, title: "password")
|
66
|
+
# ]
|
67
|
+
# )
|
60
68
|
%({{+#{Card[:email].name}|titled;title:email}}
|
61
|
-
|
69
|
+
{{+#{Card[:password].name}|titled;title:password}})
|
62
70
|
end
|
63
71
|
|
64
72
|
view :edit do
|
65
73
|
voo.structure = true
|
74
|
+
voo.edit_structure = [[:email, "email"], [:password, "password"]]
|
75
|
+
super()
|
76
|
+
end
|
77
|
+
|
78
|
+
view :edit_in_form do
|
79
|
+
voo.structure = true
|
80
|
+
voo.edit_structure = [[:email, "email"], [:password, "password"]]
|
66
81
|
super()
|
67
82
|
end
|
68
83
|
end
|
@@ -120,10 +135,7 @@ def reset_password_try_again
|
|
120
135
|
"Please check your email for a new password reset link." }
|
121
136
|
end
|
122
137
|
|
123
|
-
|
124
|
-
def edit_password_success_args
|
125
|
-
|
126
|
-
end
|
138
|
+
def edit_password_success_args; end
|
127
139
|
|
128
140
|
def reset_password?
|
129
141
|
@env_token = Env.params[:token]
|
@@ -1,7 +1,7 @@
|
|
1
1
|
|
2
2
|
format :html do
|
3
3
|
def item_links _args=nil
|
4
|
-
[
|
4
|
+
%i[my_card invite sign_out sign_up sign_in].map do |link_view|
|
5
5
|
optional_render link_view
|
6
6
|
end
|
7
7
|
end
|
@@ -50,7 +50,6 @@ format :html do
|
|
50
50
|
|
51
51
|
view(:navbar_right, cache: :never) { super() }
|
52
52
|
|
53
|
-
|
54
53
|
view :core, cache: :never do
|
55
54
|
status_class = Auth.signed_in? ? "logged-in" : "logged-out"
|
56
55
|
wrap_with :span, id: "logging", class: status_class do
|
@@ -1,10 +1,9 @@
|
|
1
1
|
format :html do
|
2
2
|
def invitation?
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
end
|
3
|
+
return @invitation unless @invitation.nil?
|
4
|
+
@invitation = Auth.signed_in? &&
|
5
|
+
(card.fetch trait: :account, new: {}).confirm_ok?
|
6
|
+
# consider making account a card_accessor?
|
8
7
|
end
|
9
8
|
|
10
9
|
view :new do
|
@@ -129,11 +129,11 @@ describe Card::Set::All::Account do
|
|
129
129
|
expect(@read_rules.member?(Card.fetch("*all+*read").id)).to be_truthy
|
130
130
|
end
|
131
131
|
|
132
|
-
it "
|
132
|
+
it "14 more should apply to Joe Admin" do
|
133
133
|
# includes lots of account rules...
|
134
134
|
Card::Auth.as("joe_admin") do
|
135
135
|
ids = Card::Auth.as_card.read_rules
|
136
|
-
expect(ids.length).to eq(@read_rules.size +
|
136
|
+
expect(ids.length).to eq(@read_rules.size + 14)
|
137
137
|
end
|
138
138
|
end
|
139
139
|
end
|
@@ -109,7 +109,7 @@ describe Card::Set::Right::Account do
|
|
109
109
|
end
|
110
110
|
|
111
111
|
describe "#update_attributes" do
|
112
|
-
before
|
112
|
+
before do
|
113
113
|
@account = Card::Auth.find_account_by_email("joe@user.com")
|
114
114
|
end
|
115
115
|
|
@@ -127,7 +127,7 @@ describe Card::Set::Right::Account do
|
|
127
127
|
end
|
128
128
|
|
129
129
|
describe "#reset_password" do
|
130
|
-
before
|
130
|
+
before do
|
131
131
|
@email = "joe@user.com"
|
132
132
|
@account = Card::Auth.find_account_by_email(@email)
|
133
133
|
@account.send_reset_password_token
|
@@ -3,7 +3,7 @@
|
|
3
3
|
# FIXME: need more specific assertions
|
4
4
|
|
5
5
|
describe Card::Set::Self::Signin do
|
6
|
-
before
|
6
|
+
before do
|
7
7
|
@card = Card[:signin]
|
8
8
|
end
|
9
9
|
|
@@ -51,7 +51,7 @@ describe Card::Set::Self::Signin do
|
|
51
51
|
end
|
52
52
|
|
53
53
|
context "#reset password" do
|
54
|
-
before
|
54
|
+
before do
|
55
55
|
Card::Env.params[:reset_password] = true
|
56
56
|
end
|
57
57
|
|
@@ -205,6 +205,10 @@ describe Card::Set::Type::Signup do
|
|
205
205
|
expect(@account.token).to be_present
|
206
206
|
expect(@account.password).not_to be_present
|
207
207
|
end
|
208
|
+
|
209
|
+
it "considers signups created by signed-in users to be invitations" do
|
210
|
+
expect(@signup.format.invitation?).to be(true)
|
211
|
+
end
|
208
212
|
end
|
209
213
|
|
210
214
|
# describe '#signup_notifications' do
|
@@ -1,8 +1,11 @@
|
|
1
1
|
format :html do
|
2
|
-
|
3
|
-
args[:ace_mode] ||= "html"
|
2
|
+
def ace_editor_input
|
4
3
|
text_area :content, rows: 5,
|
5
4
|
class: "card-content ace-editor-textarea",
|
6
|
-
"data-ace-mode" =>
|
5
|
+
"data-ace-mode" => ace_mode
|
6
|
+
end
|
7
|
+
|
8
|
+
def ace_mode
|
9
|
+
:html
|
7
10
|
end
|
8
11
|
end
|
data/mod/admin/set/self/admin.rb
CHANGED
@@ -35,9 +35,17 @@ format do
|
|
35
35
|
|
36
36
|
# DATE VIEWS
|
37
37
|
|
38
|
-
view(:created_at, closed: true) {
|
39
|
-
view(:updated_at, closed: true) {
|
40
|
-
view(:acted_at, closed: true) {
|
38
|
+
view(:created_at, closed: true) { date_view card.created_at }
|
39
|
+
view(:updated_at, closed: true) { date_view card.updated_at }
|
40
|
+
view(:acted_at, closed: true) { date_view card.acted_at }
|
41
|
+
|
42
|
+
def date_view date
|
43
|
+
if voo.variant
|
44
|
+
date.strftime voo.variant
|
45
|
+
else
|
46
|
+
time_ago_in_words date
|
47
|
+
end
|
48
|
+
end
|
41
49
|
|
42
50
|
# CONTENT VIEWS
|
43
51
|
|
@@ -1,4 +1,6 @@
|
|
1
1
|
format :json do
|
2
|
+
AUTOCOMPLETE_LIMIT = 8 # number of name suggestions for autocomplete text fields
|
3
|
+
|
2
4
|
def default_nest_view
|
3
5
|
:atom
|
4
6
|
end
|
@@ -20,11 +22,27 @@ format :json do
|
|
20
22
|
end
|
21
23
|
|
22
24
|
view :name_complete, cache: :never do
|
25
|
+
name_search
|
26
|
+
end
|
27
|
+
|
28
|
+
view :junction_name_complete, cache: :never do
|
29
|
+
name_search query_attribute: :junction_complete
|
30
|
+
end
|
31
|
+
|
32
|
+
view :name_match, cache: :never do
|
33
|
+
starts_with = name_search query_attribute: :junction_complete
|
34
|
+
remaining_slots = AUTOCOMPLETE_LIMIT - starts_with.size
|
35
|
+
return starts_with if remaining_slots.zero?
|
36
|
+
starts_with + name_search(query_attribute: :name_match,
|
37
|
+
limit: remaining_slots)
|
38
|
+
end
|
39
|
+
|
40
|
+
def name_search query_attribute: :complete, limit: AUTOCOMPLETE_LIMIT
|
23
41
|
# context is "" so that term will not be interpreted in the context
|
24
42
|
# of search card name. However, this can break searches where the
|
25
43
|
# search card name is required (eg found_by)
|
26
|
-
card.search
|
27
|
-
|
44
|
+
card.search limit: limit, sort: "name", return: "name", context: "",
|
45
|
+
query_attribute => params[:term]
|
28
46
|
end
|
29
47
|
|
30
48
|
view :status, tags: :unknown_ok, perms: :none, cache: :never do
|
@@ -37,17 +55,16 @@ format :json do
|
|
37
55
|
end
|
38
56
|
|
39
57
|
view :content, cache: :never do
|
40
|
-
|
41
|
-
{ url: (req && req.original_url),
|
58
|
+
{ url: request_url,
|
42
59
|
timestamp: Time.now.to_s,
|
43
|
-
card:
|
60
|
+
card: _render_atom }
|
44
61
|
end
|
45
62
|
|
46
63
|
view :atom, cache: :never do
|
47
64
|
h = { name: card.name, type: card.type_name }
|
48
|
-
h[:content]
|
65
|
+
h[:content] = card.content unless card.structure
|
49
66
|
h[:codename] = card.codename if card.codename
|
50
|
-
h[:value]
|
67
|
+
h[:value] = _render_core if @depth < max_depth
|
51
68
|
h
|
52
69
|
end
|
53
70
|
|
@@ -55,10 +72,35 @@ format :json do
|
|
55
72
|
view :cast, cache: :never do
|
56
73
|
card.cast
|
57
74
|
end
|
75
|
+
|
76
|
+
view :marks do
|
77
|
+
{
|
78
|
+
id: card.id,
|
79
|
+
name: card.name,
|
80
|
+
url: path
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
84
|
+
view :essentials do
|
85
|
+
if voo.show? :marks
|
86
|
+
render_marks.merge(essentials)
|
87
|
+
else
|
88
|
+
essentials
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
def essentials
|
93
|
+
return {} if card.structure
|
94
|
+
{ content: card.content }
|
95
|
+
end
|
96
|
+
|
97
|
+
def request_url
|
98
|
+
req = controller.request
|
99
|
+
req ? req.original_url : path
|
100
|
+
end
|
58
101
|
end
|
59
102
|
|
60
103
|
# TODO: perhaps this should be in a general "data" module.
|
61
104
|
def cast
|
62
105
|
real? ? { id: id } : { name: name, type_id: type_id, content: db_content }
|
63
106
|
end
|
64
|
-
|