diff --git a/lib/GADS.pm b/lib/GADS.pm index 75047ab81..f26807fec 100644 --- a/lib/GADS.pm +++ b/lib/GADS.pm @@ -1326,11 +1326,13 @@ any ['get', 'post'] => '/settings/audit/?' => require_role audit => sub { }; get '/table/?' => require_login sub { - template 'tables' => { - page => 'table', - instances => [rset('Instance')->all], - + page => 'table', + instances => [ rset('Instance')->all ], + instance_layouts => var('instances')->all, + instances_object => var('instances'), + groups => GADS::Groups->new(schema => schema)->all, + permission_inputs => GADS::Type::Permissions->permission_inputs, }; }; @@ -1410,8 +1412,7 @@ any ['get', 'post'] => '/table/:id/edit' => require_role superadmin => sub { page => 'table_edit', content_block_custom_classes => 'content-block--footer', detail_header => 1, - layout_obj => $layout, - groups => GADS::Groups->new(schema => schema)->all, + layout_obj => $layout } }; diff --git a/views/tables.tt b/views/tables.tt index 085d8aec7..6a8a799b7 100644 --- a/views/tables.tt +++ b/views/tables.tt @@ -57,7 +57,7 @@ description = "A table in LinkSpace is comparable to a worksheet in a spreadsheet. Here you can enter, create, edit, and delete your tables." aside_buttons = ! user.permission.superadmin ? [] : [{ type = "modal_button" - modalId = "tableModal" + modalId = "newTableModal" class = "btn btn-add" label = "New table" }]; @@ -66,3 +66,5 @@
In this window you will be creating a new table with topics and fields. In the first step you will + define the general properties of your table.
+Here you can set the table actions available to each user group.
+Topics are used to group fields together that can help shape the data collection forms. During data + entry a topic box forms around the fields that can either be expanded and display all fields or + collapsed and hide them from view.
+You can create topics in this window or skip this step and create them later. Topics are applied to + fields in the edit field screens.
+ +Topics are used to group fields together that can help shape the data collection forms. During data + entry a topic box forms around the fields that can either be expanded and display all fields or + collapsed and hide them from view.
+You can create topics in this window or skip this step and create them later. Topics are applied to + fields in the edit field screens.
+ ++ Topic + | +
---|
The fields are the data fields or columns in your table. Here you can add fields to your new table + and define in terms of data-type (text, date, drop-down list, etc), functionality and permissions.
+Fields created here can be edited or removed from the Edit Table menu, where new fields can be added + and the fields re-ordered if needed.
+ +Depending on your field type, here you can create settings for your field type.
+Each value in the tree is referred to as a node.
+ +Use a RAG field to automatically generate red, amber or green indicators based on the values of other fields. You set the conditions for the RAG status using the Lua programming language.
+A calculated value field automatically generates values based on the values of other fields. You define your calculation using the Lua programming language.
+In this window you can customise the permissions for this field.
++ No groups have been created yet. Create a group +
+ [% + ELSE; + # prepare table config + table_id = 'default_field_permissions_table'; + table_class = 'table-lines table-no-margin'; + table_dom = '<\"row row--header\"<\"col\"f><\"col-lg-auto dataTables_length_wrapper\"l>><\"row row--main\"<\"col-sm-12\"tr>><\"row row--footer\"<\"col-sm-12 col-lg-6\"p><\"col-sm-12 col-lg-6 dataTables_info_wrapper\"i>>'; + table_order = '[0,"asc"]'; + table_language = '{"emptyTable": "There is no groups available","lengthMenu":"Rows per page _MENU_","paginate":{"next":"Next","previous":"Previous"},"search":"","searchPlaceholder":"Search group"}'; + table_page_length = 5; + table_length_menu = 'detail'; + table_unresponsive = 1; + + table_columns = [{ + name = "Group" + orderable = 1 + width = "20%" + },{ + name = "Create" + orderable = 0 + },{ + name = "Read" + orderable = 0 + },{ + name = "Update" + orderable = 0 + },{ + name = "Approve" + orderable = 0 + },{ + name = "Write without approval" + orderable = 0 + }]; + + table_buttons = []; + rows = []; + + FOREACH group IN groups; + row = { + data_attr_name = 'group-id' + data_attr_value = group.id + fields = [{ + type = "text" + label = group.name + }, { + type = "text" + label = "" + sub_field = "fields/sub/checkbox.tt" + sub_params = { + id => "permission_write_new_" _ group.id + name => "permission_write_new_" _ group.id + label => permission_inputs.write_new + checked => 0 + filter => "html" + is_required => 0 + autofocus => 0 + input_class => "checkbox--hide-label" + label_in_span => 1 + value => 1 + } + }, { + type = "text" + label = "" + sub_field = "fields/sub/checkbox.tt" + sub_params = { + id => "permission_read_" _ group.id + name => "permission_read_" _ group.id + label => permission_inputs.read + checked => 0 + filter => "html" + is_required => 0 + autofocus => 0 + input_class => "checkbox--hide-label" + label_in_span => 1 + value => 1 + } + }, { + type = "text" + label = "" + sub_field = "fields/sub/checkbox.tt" + sub_params = { + id => "permission_write_existing_" _ group.id + name => "permission_write_existing_" _ group.id + label => permission_inputs.write_existing + checked => 0 + filter => "html" + is_required => 0 + autofocus => 0 + input_class => "checkbox--hide-label" + label_in_span => 1 + value => 1 + } + }, { + type = "text" + label = "" + sub_field = "fields/sub/checkbox.tt" + sub_params = { + id => "permission_approve_new_" _ group.id + name => "permission_approve_new_" _ group.id + label => permission_inputs.approve_new + checked => 0 + filter => "html" + is_required => 0 + autofocus => 0 + input_class => "checkbox--hide-label" + label_in_span => 1 + value => 1 + } + }, { + type = "text" + label = "" + sub_field = "fields/sub/checkbox.tt" + sub_params = { + id => "permission_write_new_no_approval_" _ group.id + name => "permission_write_new_no_approval_" _ group.id + label => permission_inputs.write_new_no_approval + checked => 0 + filter => "html" + is_required => 0 + autofocus => 0 + input_class => "checkbox--hide-label" + label_in_span => 1 + value => 1 + } + }] + }; + + rows.push(row); + END; + + INCLUDE tables/basic_table.tt; + END; + %] + +The fields are the data fields or columns in your table. Here you can add fields to your new table + and define in terms of data-type (text, date, drop-down list, etc), functionality and permissions.
+Fields created here can be edited or removed from the Edit Table menu, where new fields can be added + and the fields re-ordered if needed.
+