compony 0.11.14 → 0.12.0

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.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +30 -0
  3. data/Gemfile.lock +1 -1
  4. data/VERSION +1 -1
  5. data/compony.gemspec +3 -3
  6. data/config/locales/de.yml +1 -1
  7. data/config/locales/en.yml +1 -1
  8. data/config/locales/es.yml +1 -1
  9. data/config/locales/fr.yml +1 -1
  10. data/doc/ComponentGenerator.html +1 -1
  11. data/doc/Components.html +1 -1
  12. data/doc/ComponentsGenerator.html +1 -1
  13. data/doc/Compony/Component.html +1 -1
  14. data/doc/Compony/ComponentMixins/Default/Labelling.html +1 -1
  15. data/doc/Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html +1 -1
  16. data/doc/Compony/ComponentMixins/Default/Standalone/StandaloneDsl.html +1 -1
  17. data/doc/Compony/ComponentMixins/Default/Standalone/VerbDsl.html +1 -1
  18. data/doc/Compony/ComponentMixins/Default/Standalone.html +1 -1
  19. data/doc/Compony/ComponentMixins/Default.html +1 -1
  20. data/doc/Compony/ComponentMixins/Resourceful.html +1 -1
  21. data/doc/Compony/ComponentMixins.html +1 -1
  22. data/doc/Compony/Components/Buttons/CssButton.html +12 -1
  23. data/doc/Compony/Components/Buttons/Link.html +239 -16
  24. data/doc/Compony/Components/Buttons.html +1 -1
  25. data/doc/Compony/Components/Destroy.html +1 -1
  26. data/doc/Compony/Components/Edit.html +1 -1
  27. data/doc/Compony/Components/Form.html +83 -83
  28. data/doc/Compony/Components/Index.html +1 -1
  29. data/doc/Compony/Components/List.html +1 -1
  30. data/doc/Compony/Components/New.html +1 -1
  31. data/doc/Compony/Components/Show.html +1 -1
  32. data/doc/Compony/Components/WithForm.html +1 -1
  33. data/doc/Compony/Components.html +1 -1
  34. data/doc/Compony/ControllerMixin.html +1 -1
  35. data/doc/Compony/Engine.html +1 -1
  36. data/doc/Compony/Intent.html +1 -1
  37. data/doc/Compony/ManageIntentsDsl.html +1 -1
  38. data/doc/Compony/MethodAccessibleHash.html +1 -1
  39. data/doc/Compony/ModelFields/Anchormodel.html +1 -1
  40. data/doc/Compony/ModelFields/Association.html +1 -1
  41. data/doc/Compony/ModelFields/Attachment.html +13 -11
  42. data/doc/Compony/ModelFields/Base.html +1 -1
  43. data/doc/Compony/ModelFields/Boolean.html +1 -1
  44. data/doc/Compony/ModelFields/Color.html +1 -1
  45. data/doc/Compony/ModelFields/Currency.html +1 -1
  46. data/doc/Compony/ModelFields/Date.html +1 -1
  47. data/doc/Compony/ModelFields/Datetime.html +1 -1
  48. data/doc/Compony/ModelFields/Decimal.html +1 -1
  49. data/doc/Compony/ModelFields/Email.html +1 -1
  50. data/doc/Compony/ModelFields/Float.html +1 -1
  51. data/doc/Compony/ModelFields/Integer.html +1 -1
  52. data/doc/Compony/ModelFields/Percentage.html +1 -1
  53. data/doc/Compony/ModelFields/Phone.html +1 -1
  54. data/doc/Compony/ModelFields/RichText.html +1 -1
  55. data/doc/Compony/ModelFields/String.html +1 -1
  56. data/doc/Compony/ModelFields/Text.html +1 -1
  57. data/doc/Compony/ModelFields/Time.html +1 -1
  58. data/doc/Compony/ModelFields/Url.html +1 -1
  59. data/doc/Compony/ModelFields.html +1 -1
  60. data/doc/Compony/ModelMixin.html +1 -1
  61. data/doc/Compony/NaturalOrdering.html +1 -1
  62. data/doc/Compony/RequestContext.html +1 -1
  63. data/doc/Compony/Version.html +1 -1
  64. data/doc/Compony/ViewHelpers.html +1 -1
  65. data/doc/Compony/VirtualModel.html +1 -1
  66. data/doc/Compony.html +1 -1
  67. data/doc/ComponyController.html +1 -1
  68. data/doc/_index.html +1 -1
  69. data/doc/file.CHANGELOG.html +32 -9
  70. data/doc/file.README.html +1 -1
  71. data/doc/file.basic_component.html +1 -1
  72. data/doc/file.cookbook.html +1 -1
  73. data/doc/file.destroy.html +1 -1
  74. data/doc/file.dsl_reference.html +1 -1
  75. data/doc/file.edit.html +1 -1
  76. data/doc/file.example.html +1 -1
  77. data/doc/file.example_advanced.html +1 -1
  78. data/doc/file.feasibility.html +1 -1
  79. data/doc/file.form.html +1 -1
  80. data/doc/file.generators.html +1 -1
  81. data/doc/file.glossary.html +1 -1
  82. data/doc/file.gotchas.html +1 -1
  83. data/doc/file.index.html +1 -1
  84. data/doc/file.inheritance.html +1 -1
  85. data/doc/file.installation.html +1 -1
  86. data/doc/file.integrations.html +32 -2
  87. data/doc/file.intents.html +8 -4
  88. data/doc/file.internal_datastructures.html +1 -1
  89. data/doc/file.list.html +3 -1
  90. data/doc/file.maintaining.html +1 -1
  91. data/doc/file.model_fields.html +1 -1
  92. data/doc/file.nesting.html +1 -1
  93. data/doc/file.new.html +1 -1
  94. data/doc/file.ownership.html +1 -1
  95. data/doc/file.patterns.html +1 -1
  96. data/doc/file.pre_built_components.html +1 -1
  97. data/doc/file.resourceful.html +1 -1
  98. data/doc/file.show.html +1 -1
  99. data/doc/file.standalone.html +1 -1
  100. data/doc/file.virtual_models.html +1 -1
  101. data/doc/file.with_form.html +1 -1
  102. data/doc/guide/intents.md +6 -3
  103. data/doc/guide/pre_built_components/list.md +4 -0
  104. data/doc/index.html +1 -1
  105. data/doc/integrations.md +46 -1
  106. data/doc/method_list.html +69 -53
  107. data/doc/top-level-namespace.html +1 -1
  108. data/lib/compony/components/buttons/link.rb +37 -2
  109. data/lib/compony/components/form.rb +2 -6
  110. data/lib/compony/model_fields/attachment.rb +7 -6
  111. data/spec/compony/components/buttons/link_spec.rb +73 -0
  112. data/spec/compony/model_fields/attachment_spec.rb +41 -0
  113. data/spec/requests/users_crud_spec.rb +7 -0
  114. metadata +3 -1
data/doc/method_list.html CHANGED
@@ -925,6 +925,14 @@
925
925
 
926
926
 
927
927
  <li class="odd ">
928
+ <div class="item">
929
+ <span class='object_link'><a href="Compony/Components/Buttons/Link.html#link_or_button-instance_method" title="Compony::Components::Buttons::Link#link_or_button (method)">#link_or_button</a></span>
930
+ <small>Compony::Components::Buttons::Link</small>
931
+ </div>
932
+ </li>
933
+
934
+
935
+ <li class="even ">
928
936
  <div class="item">
929
937
  <span class='object_link'><a href="Compony/ComponentMixins/Resourceful.html#load_data-instance_method" title="Compony::ComponentMixins::Resourceful#load_data (method)">#load_data</a></span>
930
938
  <small>Compony::ComponentMixins::Resourceful</small>
@@ -932,7 +940,7 @@
932
940
  </li>
933
941
 
934
942
 
935
- <li class="even ">
943
+ <li class="odd ">
936
944
  <div class="item">
937
945
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone/ResourcefulVerbDsl.html#load_data-instance_method" title="Compony::ComponentMixins::Default::Standalone::ResourcefulVerbDsl#load_data (method)">#load_data</a></span>
938
946
  <small>Compony::ComponentMixins::Default::Standalone::ResourcefulVerbDsl</small>
@@ -940,7 +948,7 @@
940
948
  </li>
941
949
 
942
950
 
943
- <li class="odd ">
951
+ <li class="even ">
944
952
  <div class="item">
945
953
  <span class='object_link'><a href="Compony/RequestContext.html#local_assigns-instance_method" title="Compony::RequestContext#local_assigns (method)">#local_assigns</a></span>
946
954
  <small>Compony::RequestContext</small>
@@ -948,7 +956,7 @@
948
956
  </li>
949
957
 
950
958
 
951
- <li class="even ">
959
+ <li class="odd ">
952
960
  <div class="item">
953
961
  <span class='object_link'><a href="Compony/MethodAccessibleHash.html#merge-instance_method" title="Compony::MethodAccessibleHash#merge (method)">#merge</a></span>
954
962
  <small>Compony::MethodAccessibleHash</small>
@@ -956,7 +964,7 @@
956
964
  </li>
957
965
 
958
966
 
959
- <li class="odd ">
967
+ <li class="even ">
960
968
  <div class="item">
961
969
  <span class='object_link'><a href="Compony/Intent.html#method-instance_method" title="Compony::Intent#method (method)">#method</a></span>
962
970
  <small>Compony::Intent</small>
@@ -964,7 +972,7 @@
964
972
  </li>
965
973
 
966
974
 
967
- <li class="even ">
975
+ <li class="odd ">
968
976
  <div class="item">
969
977
  <span class='object_link'><a href="Compony/RequestContext.html#method_missing-instance_method" title="Compony::RequestContext#method_missing (method)">#method_missing</a></span>
970
978
  <small>Compony::RequestContext</small>
@@ -972,7 +980,7 @@
972
980
  </li>
973
981
 
974
982
 
975
- <li class="odd ">
983
+ <li class="even ">
976
984
  <div class="item">
977
985
  <span class='object_link'><a href="Compony/MethodAccessibleHash.html#method_missing-instance_method" title="Compony::MethodAccessibleHash#method_missing (method)">#method_missing</a></span>
978
986
  <small>Compony::MethodAccessibleHash</small>
@@ -980,7 +988,7 @@
980
988
  </li>
981
989
 
982
990
 
983
- <li class="even ">
991
+ <li class="odd ">
984
992
  <div class="item">
985
993
  <span class='object_link'><a href="Compony/Intent.html#model%3F-instance_method" title="Compony::Intent#model? (method)">#model?</a></span>
986
994
  <small>Compony::Intent</small>
@@ -988,7 +996,7 @@
988
996
  </li>
989
997
 
990
998
 
991
- <li class="odd ">
999
+ <li class="even ">
992
1000
  <div class="item">
993
1001
  <span class='object_link'><a href="Compony/ModelFields/Base.html#model_class-instance_method" title="Compony::ModelFields::Base#model_class (method)">#model_class</a></span>
994
1002
  <small>Compony::ModelFields::Base</small>
@@ -996,7 +1004,7 @@
996
1004
  </li>
997
1005
 
998
1006
 
999
- <li class="even ">
1007
+ <li class="odd ">
1000
1008
  <div class="item">
1001
1009
  <span class='object_link'><a href="Compony.html#model_field_class_for-class_method" title="Compony.model_field_class_for (method)">model_field_class_for</a></span>
1002
1010
  <small>Compony</small>
@@ -1004,7 +1012,7 @@
1004
1012
  </li>
1005
1013
 
1006
1014
 
1007
- <li class="odd ">
1015
+ <li class="even ">
1008
1016
  <div class="item">
1009
1017
  <span class='object_link'><a href="Compony.html#model_field_namespaces-class_method" title="Compony.model_field_namespaces (method)">model_field_namespaces</a></span>
1010
1018
  <small>Compony</small>
@@ -1012,7 +1020,7 @@
1012
1020
  </li>
1013
1021
 
1014
1022
 
1015
- <li class="even ">
1023
+ <li class="odd ">
1016
1024
  <div class="item">
1017
1025
  <span class='object_link'><a href="Compony.html#model_field_namespaces=-class_method" title="Compony.model_field_namespaces= (method)">model_field_namespaces=</a></span>
1018
1026
  <small>Compony</small>
@@ -1020,7 +1028,7 @@
1020
1028
  </li>
1021
1029
 
1022
1030
 
1023
- <li class="odd ">
1031
+ <li class="even ">
1024
1032
  <div class="item">
1025
1033
  <span class='object_link'><a href="Compony/ModelFields/Base.html#multi%3F-instance_method" title="Compony::ModelFields::Base#multi? (method)">#multi?</a></span>
1026
1034
  <small>Compony::ModelFields::Base</small>
@@ -1028,7 +1036,7 @@
1028
1036
  </li>
1029
1037
 
1030
1038
 
1031
- <li class="even ">
1039
+ <li class="odd ">
1032
1040
  <div class="item">
1033
1041
  <span class='object_link'><a href="Compony/Intent.html#name-instance_method" title="Compony::Intent#name (method)">#name</a></span>
1034
1042
  <small>Compony::Intent</small>
@@ -1036,7 +1044,7 @@
1036
1044
  </li>
1037
1045
 
1038
1046
 
1039
- <li class="odd ">
1047
+ <li class="even ">
1040
1048
  <div class="item">
1041
1049
  <span class='object_link'><a href="Compony/ModelFields/Base.html#name-instance_method" title="Compony::ModelFields::Base#name (method)">#name</a></span>
1042
1050
  <small>Compony::ModelFields::Base</small>
@@ -1044,7 +1052,7 @@
1044
1052
  </li>
1045
1053
 
1046
1054
 
1047
- <li class="even ">
1055
+ <li class="odd ">
1048
1056
  <div class="item">
1049
1057
  <span class='object_link'><a href="Compony/NaturalOrdering.html#natural_push-instance_method" title="Compony::NaturalOrdering#natural_push (method)">#natural_push</a></span>
1050
1058
  <small>Compony::NaturalOrdering</small>
@@ -1052,7 +1060,7 @@
1052
1060
  </li>
1053
1061
 
1054
1062
 
1055
- <li class="odd ">
1063
+ <li class="even ">
1056
1064
  <div class="item">
1057
1065
  <span class='object_link'><a href="Compony/Components/New.html#on_create_failed_respond-instance_method" title="Compony::Components::New#on_create_failed_respond (method)">#on_create_failed_respond</a></span>
1058
1066
  <small>Compony::Components::New</small>
@@ -1060,7 +1068,7 @@
1060
1068
  </li>
1061
1069
 
1062
1070
 
1063
- <li class="even ">
1071
+ <li class="odd ">
1064
1072
  <div class="item">
1065
1073
  <span class='object_link'><a href="Compony/Components/New.html#on_created-instance_method" title="Compony::Components::New#on_created (method)">#on_created</a></span>
1066
1074
  <small>Compony::Components::New</small>
@@ -1068,7 +1076,7 @@
1068
1076
  </li>
1069
1077
 
1070
1078
 
1071
- <li class="odd ">
1079
+ <li class="even ">
1072
1080
  <div class="item">
1073
1081
  <span class='object_link'><a href="Compony/Components/New.html#on_created_redirect_path-instance_method" title="Compony::Components::New#on_created_redirect_path (method)">#on_created_redirect_path</a></span>
1074
1082
  <small>Compony::Components::New</small>
@@ -1076,7 +1084,7 @@
1076
1084
  </li>
1077
1085
 
1078
1086
 
1079
- <li class="even ">
1087
+ <li class="odd ">
1080
1088
  <div class="item">
1081
1089
  <span class='object_link'><a href="Compony/Components/New.html#on_created_respond-instance_method" title="Compony::Components::New#on_created_respond (method)">#on_created_respond</a></span>
1082
1090
  <small>Compony::Components::New</small>
@@ -1084,7 +1092,7 @@
1084
1092
  </li>
1085
1093
 
1086
1094
 
1087
- <li class="odd ">
1095
+ <li class="even ">
1088
1096
  <div class="item">
1089
1097
  <span class='object_link'><a href="Compony/Components/Destroy.html#on_destroyed-instance_method" title="Compony::Components::Destroy#on_destroyed (method)">#on_destroyed</a></span>
1090
1098
  <small>Compony::Components::Destroy</small>
@@ -1092,7 +1100,7 @@
1092
1100
  </li>
1093
1101
 
1094
1102
 
1095
- <li class="even ">
1103
+ <li class="odd ">
1096
1104
  <div class="item">
1097
1105
  <span class='object_link'><a href="Compony/Components/Destroy.html#on_destroyed_redirect_path-instance_method" title="Compony::Components::Destroy#on_destroyed_redirect_path (method)">#on_destroyed_redirect_path</a></span>
1098
1106
  <small>Compony::Components::Destroy</small>
@@ -1100,7 +1108,7 @@
1100
1108
  </li>
1101
1109
 
1102
1110
 
1103
- <li class="odd ">
1111
+ <li class="even ">
1104
1112
  <div class="item">
1105
1113
  <span class='object_link'><a href="Compony/Components/Destroy.html#on_destroyed_respond-instance_method" title="Compony::Components::Destroy#on_destroyed_respond (method)">#on_destroyed_respond</a></span>
1106
1114
  <small>Compony::Components::Destroy</small>
@@ -1108,7 +1116,7 @@
1108
1116
  </li>
1109
1117
 
1110
1118
 
1111
- <li class="even ">
1119
+ <li class="odd ">
1112
1120
  <div class="item">
1113
1121
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone.html#on_standalone_access-instance_method" title="Compony::ComponentMixins::Default::Standalone#on_standalone_access (method)">#on_standalone_access</a></span>
1114
1122
  <small>Compony::ComponentMixins::Default::Standalone</small>
@@ -1116,7 +1124,7 @@
1116
1124
  </li>
1117
1125
 
1118
1126
 
1119
- <li class="odd ">
1127
+ <li class="even ">
1120
1128
  <div class="item">
1121
1129
  <span class='object_link'><a href="Compony/Components/Edit.html#on_update_failed-instance_method" title="Compony::Components::Edit#on_update_failed (method)">#on_update_failed</a></span>
1122
1130
  <small>Compony::Components::Edit</small>
@@ -1124,7 +1132,7 @@
1124
1132
  </li>
1125
1133
 
1126
1134
 
1127
- <li class="even ">
1135
+ <li class="odd ">
1128
1136
  <div class="item">
1129
1137
  <span class='object_link'><a href="Compony/Components/Edit.html#on_updated-instance_method" title="Compony::Components::Edit#on_updated (method)">#on_updated</a></span>
1130
1138
  <small>Compony::Components::Edit</small>
@@ -1132,7 +1140,7 @@
1132
1140
  </li>
1133
1141
 
1134
1142
 
1135
- <li class="odd ">
1143
+ <li class="even ">
1136
1144
  <div class="item">
1137
1145
  <span class='object_link'><a href="Compony/Components/Edit.html#on_updated_redirect_path-instance_method" title="Compony::Components::Edit#on_updated_redirect_path (method)">#on_updated_redirect_path</a></span>
1138
1146
  <small>Compony::Components::Edit</small>
@@ -1140,7 +1148,7 @@
1140
1148
  </li>
1141
1149
 
1142
1150
 
1143
- <li class="even ">
1151
+ <li class="odd ">
1144
1152
  <div class="item">
1145
1153
  <span class='object_link'><a href="Compony/Components/Edit.html#on_updated_respond-instance_method" title="Compony::Components::Edit#on_updated_respond (method)">#on_updated_respond</a></span>
1146
1154
  <small>Compony::Components::Edit</small>
@@ -1148,7 +1156,7 @@
1148
1156
  </li>
1149
1157
 
1150
1158
 
1151
- <li class="odd ">
1159
+ <li class="even ">
1152
1160
  <div class="item">
1153
1161
  <span class='object_link'><a href="Compony/Components/List.html#pagination-instance_method" title="Compony::Components::List#pagination (method)">#pagination</a></span>
1154
1162
  <small>Compony::Components::List</small>
@@ -1156,7 +1164,7 @@
1156
1164
  </li>
1157
1165
 
1158
1166
 
1159
- <li class="even ">
1167
+ <li class="odd ">
1160
1168
  <div class="item">
1161
1169
  <span class='object_link'><a href="Compony/Components/List.html#pagination_enabled%3F-instance_method" title="Compony::Components::List#pagination_enabled? (method)">#pagination_enabled?</a></span>
1162
1170
  <small>Compony::Components::List</small>
@@ -1164,7 +1172,7 @@
1164
1172
  </li>
1165
1173
 
1166
1174
 
1167
- <li class="odd ">
1175
+ <li class="even ">
1168
1176
  <div class="item">
1169
1177
  <span class='object_link'><a href="Compony/Component.html#param_name-instance_method" title="Compony::Component#param_name (method)">#param_name</a></span>
1170
1178
  <small>Compony::Component</small>
@@ -1172,7 +1180,7 @@
1172
1180
  </li>
1173
1181
 
1174
1182
 
1175
- <li class="even ">
1183
+ <li class="odd ">
1176
1184
  <div class="item">
1177
1185
  <span class='object_link'><a href="Compony/Component.html#parent_comp-instance_method" title="Compony::Component#parent_comp (method)">#parent_comp</a></span>
1178
1186
  <small>Compony::Component</small>
@@ -1180,7 +1188,7 @@
1180
1188
  </li>
1181
1189
 
1182
1190
 
1183
- <li class="odd ">
1191
+ <li class="even ">
1184
1192
  <div class="item">
1185
1193
  <span class='object_link'><a href="Compony.html#path-class_method" title="Compony.path (method)">path</a></span>
1186
1194
  <small>Compony</small>
@@ -1188,7 +1196,7 @@
1188
1196
  </li>
1189
1197
 
1190
1198
 
1191
- <li class="even ">
1199
+ <li class="odd ">
1192
1200
  <div class="item">
1193
1201
  <span class='object_link'><a href="Compony/Intent.html#path-instance_method" title="Compony::Intent#path (method)">#path</a></span>
1194
1202
  <small>Compony::Intent</small>
@@ -1196,7 +1204,7 @@
1196
1204
  </li>
1197
1205
 
1198
1206
 
1199
- <li class="odd ">
1207
+ <li class="even ">
1200
1208
  <div class="item">
1201
1209
  <span class='object_link'><a href="Compony/Component.html#path-instance_method" title="Compony::Component#path (method)">#path</a></span>
1202
1210
  <small>Compony::Component</small>
@@ -1204,7 +1212,7 @@
1204
1212
  </li>
1205
1213
 
1206
1214
 
1207
- <li class="even ">
1215
+ <li class="odd ">
1208
1216
  <div class="item">
1209
1217
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone.html#path_helper_name-instance_method" title="Compony::ComponentMixins::Default::Standalone#path_helper_name (method)">#path_helper_name</a></span>
1210
1218
  <small>Compony::ComponentMixins::Default::Standalone</small>
@@ -1212,7 +1220,7 @@
1212
1220
  </li>
1213
1221
 
1214
1222
 
1215
- <li class="odd ">
1223
+ <li class="even ">
1216
1224
  <div class="item">
1217
1225
  <span class='object_link'><a href="Compony/Components/Buttons/Link.html#prepare_opts!-instance_method" title="Compony::Components::Buttons::Link#prepare_opts! (method)">#prepare_opts!</a></span>
1218
1226
  <small>Compony::Components::Buttons::Link</small>
@@ -1220,7 +1228,7 @@
1220
1228
  </li>
1221
1229
 
1222
1230
 
1223
- <li class="even ">
1231
+ <li class="odd ">
1224
1232
  <div class="item">
1225
1233
  <span class='object_link'><a href="Compony/Components/Buttons/CssButton.html#prepare_opts!-instance_method" title="Compony::Components::Buttons::CssButton#prepare_opts! (method)">#prepare_opts!</a></span>
1226
1234
  <small>Compony::Components::Buttons::CssButton</small>
@@ -1228,7 +1236,7 @@
1228
1236
  </li>
1229
1237
 
1230
1238
 
1231
- <li class="odd ">
1239
+ <li class="even ">
1232
1240
  <div class="item">
1233
1241
  <span class='object_link'><a href="Compony/Components/List.html#process_data!-instance_method" title="Compony::Components::List#process_data! (method)">#process_data!</a></span>
1234
1242
  <small>Compony::Components::List</small>
@@ -1236,7 +1244,7 @@
1236
1244
  </li>
1237
1245
 
1238
1246
 
1239
- <li class="even ">
1247
+ <li class="odd ">
1240
1248
  <div class="item">
1241
1249
  <span class='object_link'><a href="Compony/Components/Form.html#pw_field-instance_method" title="Compony::Components::Form#pw_field (method)">#pw_field</a></span>
1242
1250
  <small>Compony::Components::Form</small>
@@ -1244,7 +1252,7 @@
1244
1252
  </li>
1245
1253
 
1246
1254
 
1247
- <li class="odd ">
1255
+ <li class="even ">
1248
1256
  <div class="item">
1249
1257
  <span class='object_link'><a href="Compony/ComponentMixins/Default/Standalone.html#rails_action_name-instance_method" title="Compony::ComponentMixins::Default::Standalone#rails_action_name (method)">#rails_action_name</a></span>
1250
1258
  <small>Compony::ComponentMixins::Default::Standalone</small>
@@ -1252,7 +1260,7 @@
1252
1260
  </li>
1253
1261
 
1254
1262
 
1255
- <li class="even ">
1263
+ <li class="odd ">
1256
1264
  <div class="item">
1257
1265
  <span class='object_link'><a href="Compony/ModelFields/Base.html#ransack_filter_input-instance_method" title="Compony::ModelFields::Base#ransack_filter_input (method)">#ransack_filter_input</a></span>
1258
1266
  <small>Compony::ModelFields::Base</small>
@@ -1260,7 +1268,7 @@
1260
1268
  </li>
1261
1269
 
1262
1270
 
1263
- <li class="odd ">
1271
+ <li class="even ">
1264
1272
  <div class="item">
1265
1273
  <span class='object_link'><a href="Compony/ModelFields/Boolean.html#ransack_filter_input-instance_method" title="Compony::ModelFields::Boolean#ransack_filter_input (method)">#ransack_filter_input</a></span>
1266
1274
  <small>Compony::ModelFields::Boolean</small>
@@ -1268,7 +1276,7 @@
1268
1276
  </li>
1269
1277
 
1270
1278
 
1271
- <li class="even ">
1279
+ <li class="odd ">
1272
1280
  <div class="item">
1273
1281
  <span class='object_link'><a href="Compony/ModelFields/Anchormodel.html#ransack_filter_input-instance_method" title="Compony::ModelFields::Anchormodel#ransack_filter_input (method)">#ransack_filter_input</a></span>
1274
1282
  <small>Compony::ModelFields::Anchormodel</small>
@@ -1276,7 +1284,7 @@
1276
1284
  </li>
1277
1285
 
1278
1286
 
1279
- <li class="odd ">
1287
+ <li class="even ">
1280
1288
  <div class="item">
1281
1289
  <span class='object_link'><a href="Compony/ModelFields/Base.html#ransack_filter_name-instance_method" title="Compony::ModelFields::Base#ransack_filter_name (method)">#ransack_filter_name</a></span>
1282
1290
  <small>Compony::ModelFields::Base</small>
@@ -1284,7 +1292,7 @@
1284
1292
  </li>
1285
1293
 
1286
1294
 
1287
- <li class="even ">
1295
+ <li class="odd ">
1288
1296
  <div class="item">
1289
1297
  <span class='object_link'><a href="Compony/ModelFields/Boolean.html#ransack_filter_name-instance_method" title="Compony::ModelFields::Boolean#ransack_filter_name (method)">#ransack_filter_name</a></span>
1290
1298
  <small>Compony::ModelFields::Boolean</small>
@@ -1292,7 +1300,7 @@
1292
1300
  </li>
1293
1301
 
1294
1302
 
1295
- <li class="odd ">
1303
+ <li class="even ">
1296
1304
  <div class="item">
1297
1305
  <span class='object_link'><a href="Compony/ModelFields/Integer.html#ransack_filter_name-instance_method" title="Compony::ModelFields::Integer#ransack_filter_name (method)">#ransack_filter_name</a></span>
1298
1306
  <small>Compony::ModelFields::Integer</small>
@@ -1300,7 +1308,7 @@
1300
1308
  </li>
1301
1309
 
1302
1310
 
1303
- <li class="even ">
1311
+ <li class="odd ">
1304
1312
  <div class="item">
1305
1313
  <span class='object_link'><a href="Compony/ModelFields/Anchormodel.html#ransack_filter_name-instance_method" title="Compony::ModelFields::Anchormodel#ransack_filter_name (method)">#ransack_filter_name</a></span>
1306
1314
  <small>Compony::ModelFields::Anchormodel</small>
@@ -1308,7 +1316,7 @@
1308
1316
  </li>
1309
1317
 
1310
1318
 
1311
- <li class="odd ">
1319
+ <li class="even ">
1312
1320
  <div class="item">
1313
1321
  <span class='object_link'><a href="Compony.html#register_button_style-class_method" title="Compony.register_button_style (method)">register_button_style</a></span>
1314
1322
  <small>Compony</small>
@@ -1316,7 +1324,7 @@
1316
1324
  </li>
1317
1325
 
1318
1326
 
1319
- <li class="even ">
1327
+ <li class="odd ">
1320
1328
  <div class="item">
1321
1329
  <span class='object_link'><a href="Compony/ManageIntentsDsl.html#remove-instance_method" title="Compony::ManageIntentsDsl#remove (method)">#remove</a></span>
1322
1330
  <small>Compony::ManageIntentsDsl</small>
@@ -1324,7 +1332,7 @@
1324
1332
  </li>
1325
1333
 
1326
1334
 
1327
- <li class="odd ">
1335
+ <li class="even ">
1328
1336
  <div class="item">
1329
1337
  <span class='object_link'><a href="Compony/Component.html#remove_content-instance_method" title="Compony::Component#remove_content (method)">#remove_content</a></span>
1330
1338
  <small>Compony::Component</small>
@@ -1332,7 +1340,7 @@
1332
1340
  </li>
1333
1341
 
1334
1342
 
1335
- <li class="even ">
1343
+ <li class="odd ">
1336
1344
  <div class="item">
1337
1345
  <span class='object_link'><a href="Compony/Component.html#remove_content!-instance_method" title="Compony::Component#remove_content! (method)">#remove_content!</a></span>
1338
1346
  <small>Compony::Component</small>
@@ -1340,7 +1348,7 @@
1340
1348
  </li>
1341
1349
 
1342
1350
 
1343
- <li class="odd ">
1351
+ <li class="even ">
1344
1352
  <div class="item">
1345
1353
  <span class='object_link'><a href="Compony/Intent.html#render-instance_method" title="Compony::Intent#render (method)">#render</a></span>
1346
1354
  <small>Compony::Intent</small>
@@ -1348,7 +1356,7 @@
1348
1356
  </li>
1349
1357
 
1350
1358
 
1351
- <li class="even ">
1359
+ <li class="odd ">
1352
1360
  <div class="item">
1353
1361
  <span class='object_link'><a href="Compony/Component.html#render-instance_method" title="Compony::Component#render (method)">#render</a></span>
1354
1362
  <small>Compony::Component</small>
@@ -1356,6 +1364,14 @@
1356
1364
  </li>
1357
1365
 
1358
1366
 
1367
+ <li class="even ">
1368
+ <div class="item">
1369
+ <span class='object_link'><a href="Compony/Components/Buttons/Link.html#render-instance_method" title="Compony::Components::Buttons::Link#render (method)">#render</a></span>
1370
+ <small>Compony::Components::Buttons::Link</small>
1371
+ </div>
1372
+ </li>
1373
+
1374
+
1359
1375
  <li class="odd ">
1360
1376
  <div class="item">
1361
1377
  <span class='object_link'><a href="Compony/ViewHelpers.html#render_intent-instance_method" title="Compony::ViewHelpers#render_intent (method)">#render_intent</a></span>
@@ -102,7 +102,7 @@
102
102
  </div>
103
103
 
104
104
  <div id="footer">
105
- Generated on Wed Oct 7 10:48:19 2026 by
105
+ Generated on Wed Nov 25 14:15:19 2026 by
106
106
  <a href="https://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
107
107
  0.9.34 (ruby-3.4.9).
108
108
  </div>
@@ -2,13 +2,47 @@ module Compony
2
2
  module Components
3
3
  module Buttons
4
4
  class Link < Component
5
+ # Legacy value of `@href` when no `href` was given. {#link_or_button} renders an `<a>` without `href` in this case. The value only
6
+ # remains so that button styles that still call `link_to(@href, ...)` themselves keep their former markup until they render
7
+ # through {#link_or_button}. A `javascript:` URL violates any Content Security Policy that does not allow inline scripts.
8
+ NO_HREF = 'javascript:void(0)'.freeze
9
+
5
10
  setup do
6
11
  before_render do
7
12
  prepare_opts!
8
13
  end
9
14
 
10
15
  content do
11
- concat link_to(@label, @href, **@comp_opts)
16
+ concat link_or_button
17
+ end
18
+ end
19
+
20
+ def render(...)
21
+ html = super
22
+ if html && @type && !@link_or_button_rendered
23
+ fail "#{self.class} was given `type: #{@type.inspect}` but did not render through `link_or_button`, so it rendered a link instead " \
24
+ 'of a <button>. Render the element with `component.link_or_button(...)` in the content block instead of `link_to`.'
25
+ end
26
+ return html
27
+ end
28
+
29
+ # Renders the HTML element of this button:
30
+ # - a `<button>` of the given type if `type:` was given (e.g. `:submit` for a form's submit button),
31
+ # - an `<a>` without `href` if no `href` was given (clicking it does nothing, and it needs no JavaScript),
32
+ # - a regular link otherwise.
33
+ # Button styles that override `content` must render through this method rather than calling `link_to(@href, ...)` themselves.
34
+ # @param inner_html [String] Content of the element, defaults to the label. To pass markup, use e.g. `capture { span 'x' }`.
35
+ # @param html_opts [Hash] HTML attributes of the element, defaults to the button's options left after `prepare_opts!`.
36
+ def link_or_button(inner_html = @label, html_opts = @comp_opts)
37
+ @link_or_button_rendered = true
38
+ helpers = ActionController::Base.helpers
39
+ if @type
40
+ disabled = html_opts[:disabled] || html_opts[:class]&.split&.include?('disabled')
41
+ return helpers.content_tag(:button, inner_html, **html_opts, type: @type, disabled:)
42
+ elsif @href == NO_HREF
43
+ return helpers.content_tag(:a, inner_html, **html_opts)
44
+ else
45
+ return helpers.link_to(inner_html, @href, **html_opts)
12
46
  end
13
47
  end
14
48
 
@@ -16,7 +50,8 @@ module Compony
16
50
 
17
51
  def prepare_opts!
18
52
  @label = @comp_opts.delete(:label).presence
19
- @href = @comp_opts.delete(:href).presence || 'javascript:void(0)'
53
+ @href = @comp_opts.delete(:href).presence || NO_HREF
54
+ @type = @comp_opts.delete(:type).presence&.to_sym
20
55
  @method = @comp_opts.delete(:method).presence
21
56
  if @method && @method.to_sym != :get
22
57
  @comp_opts[:data] = { turbo_method: @method }.merge(@comp_opts[:data] || {})
@@ -25,12 +25,8 @@ module Compony
25
25
 
26
26
  # Override this to provide a custom submit button
27
27
  content :submit_button, hidden: true do
28
- # Fake submit button rendered by a button component and submitting the form via JS:
29
- concat render_intent(name: :submit, label: @submit_label || I18n.t('compony.components.form.submit'), button: {
30
- onclick: "this.closest('form').requestSubmit(); return false;"
31
- })
32
- # Real (but hidden) submit button to allow Return to submit:
33
- button type: :submit, hidden: true
28
+ # Rendered by the button component as a real `<button type="submit">`, which also makes Return submit the form.
29
+ concat render_intent(name: :submit, label: @submit_label || I18n.t('compony.components.form.submit'), button: { type: :submit })
34
30
  end
35
31
 
36
32
  # Override this to provide additional submit buttons.
@@ -32,15 +32,16 @@ module Compony
32
32
  helpers = ActionController::Base.helpers
33
33
  return helpers.capture do
34
34
  helpers.concat form.label(name)
35
- # List currently present attachments along with a remove button (done in JS)
35
+ # List currently present attachments, each with a checked checkbox submitting its signed id. Unchecking it drops the id
36
+ # from the submitted list, which removes the attachment on save. This needs no JavaScript.
36
37
  helpers.div class: 'compony-attachments-item-wrapper' do
37
38
  form.object.send(name).each do |attachment|
39
+ checkbox_id = "#{form.object.model_name.singular}_#{name}_keep_#{attachment.id}"
38
40
  helpers.div class: 'compony-attachments-item' do
39
- helpers.concat helpers.hidden_field_tag("#{form.object.model_name.singular}[#{name}][]", attachment.signed_id)
40
- helpers.span attachment.filename, class: 'compony-attachments-filename'
41
- helpers.span ' ', class: 'compony-attachments-spacer'
42
- helpers.concat helpers.link_to(I18n.t('compony.model_fields.attachment.remove'), '#',
43
- onclick: "event.preventDefault(); this.closest('div').remove();")
41
+ helpers.concat helpers.check_box_tag("#{form.object.model_name.singular}[#{name}][]", attachment.signed_id, true,
42
+ id: checkbox_id, class: 'compony-attachments-keep',
43
+ title: I18n.t('compony.model_fields.attachment.keep_hint'))
44
+ helpers.concat helpers.label_tag(checkbox_id, attachment.filename, class: 'compony-attachments-filename')
44
45
  end
45
46
  end
46
47
  end