-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement support for file field in Drupalgap #825
base: 7.x-1.x
Are you sure you want to change the base?
Changes from 3 commits
a2885d4
c46a15b
a2d6852
b11138c
79b3cc8
e6ab200
c0967ea
e0523e5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ function _drupalgap_form_add_another_item(form_id, name, delta) { | |
// Locate the last item, load the form, extract the element from | ||
// the form, generate default variables for the new item, determine the next | ||
// delta value. | ||
var selector = '.' + drupalgap_form_get_element_container_class(name) + | ||
' .drupalgap_form_add_another_item'; | ||
var selector = '.' + drupalgap_form_get_element_container_class(name).replace(/\s+/g, '.') + ' .drupalgap_form_add_another_item'; | ||
console.log('selector: ' + selector); | ||
var add_another_item_button = $(selector); | ||
var form = drupalgap_form_local_storage_load(form_id); | ||
var language = language_default(); | ||
|
@@ -24,7 +24,10 @@ function _drupalgap_form_add_another_item(form_id, name, delta) { | |
form.elements[name][language][delta + 1] = item; | ||
var element = form.elements[name]; | ||
var variables = { | ||
attributes: {}, | ||
attributes: { | ||
id: item.id, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @luxio Do you think we'll need the delta value to be appended to the ID here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the delta value is appended to the id by |
||
value: '' | ||
}, | ||
field_info_field: element.field_info_field, | ||
field_info_instance: element.field_info_instance | ||
}; | ||
|
@@ -42,8 +45,19 @@ function _drupalgap_form_add_another_item(form_id, name, delta) { | |
); | ||
drupalgap_form_local_storage_save(form); | ||
$(add_another_item_button).before( | ||
_drupalgap_form_render_element_item(form, element, variables, item) | ||
_drupalgap_form_render_element_item(form, element, variables, item) | ||
); | ||
// increment delta of the add another button item | ||
$(add_another_item_button).attr("onclick", | ||
"javascript:_drupalgap_form_add_another_item('" + | ||
form.id + "', '" + | ||
element.name + "', " + | ||
(delta + 1) + | ||
")" | ||
); | ||
// enhance the markup of dynamically added element | ||
$('#' + drupalgap_get_page_id()).trigger('create'); | ||
|
||
} | ||
catch (error) { console.log('_drupalgap_form_add_another_item - ' + error); } | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luxio Please wrap this in a t(),
text: t('Add another item')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done