silverstripe-frontend
silverstripe-frontend copied to clipboard
I've question
Can I see somewhere working sample? I see error like this fig.
Is needed load jquery.ui too?
What I noticed for myself, that all the following should be called ABOVE the pagination.
jQuery jQuery UI underscore.js (include frontend/javascript/underscore.js) lib.js (include framework/admin/javascript/lib.js)
Thank you for your answer. I think, many users don't know about file and location lib.js... It'd be very good idea write to docs st. like:
public function init() { parent::init(); Requirements::javascript('framework/thirdparty/jquery-ui/jquery-ui.js'); Requirements::javascript('framework/admin/javascript/lib.js'); Requirements::javascript('AjaxPagination/javascript/jquery.ss.pagination.js'); //Requirements::javascript('AjaxPagination/javascript/jquery.ss.endles.js'); Requirements::javascript('AjaxPagination/javascript/underscore.js'); Requirements::customScript(<<<JS $('div.Ajaxpagination').sspagination({ indicatorElement: $('.pagination-indicator'), contentSelector: '.pagination-content' }); JS ); ........... }
Why is module name silverstripe-frontend? I think better name it'd be AjaxPagination (as I renamed in my project).
Good work:)
I've still question. I had to rewrite (for bootstrap) template as:
templates: { main: '
- <%= inside %>
Do you know some solution how to use custom template (e. g.: options)?
Ops. I cannot send template variable.
Thank you.
I've still question. I had to rewrite (for bootstrap) template as:
templates: { main: '
- <%= inside %>
Do you know some solution, how to use custom template e.g.: in options?
On Thursday 22.8.2013 15:43, ARNHOE wrote:
What I noticed for myself, that all the following should be called ABOVE the pagination.
jQuery jQuery UI underscore.js (include frontend/javascript/underscore.js) lib.js (include framework/admin/javascript/lib.js)
— Reply to this email directly or view it on GitHub https://github.com/mateusz/silverstripe-frontend/issues/17#issuecomment-23090612.
Yours sincerely - S pozdravem
My momma always said, "Life was like a box of chocolates. You never know what you're gonna get." Moje máma vždycky říkala, "Život je jako bonboniéra. Nikdy nevíte, co dostaneš."
-- Forrest Gump
Jaroslav Stika (Pike)
Address: Zdiarska 1/5, 040 01 Kosice, Slovakia Work Phone#: +421 55 62 62 53 839 Home Phone#: +421 09 05 52 87 68 Work eMail: [email protected] Home eMail: [email protected] ICQ#: 246 120 400
@JStika Good point, added a note on the requirements here: https://github.com/mateusz/silverstripe-frontend#pulling-in-the-requirements, thanks!
Regarding the templates, should be an easy job, no need to overwrite the source code! You are almost there, just use the jQuery widgets API:
$('div.pagination').sspagination({
contentSelector: '.content',
templates: {
// Insert your custom template code here.
}
});
Have a look at the docs too: https://github.com/mateusz/silverstripe-frontend#template-customisation
And also here, for different ways of working with underscore templates: http://underscorejs.org/#template
Ah yeah, and the naming is like that because I thought there would be other SilverStripe-related widgets that would be useful in the frontend, so I didn't want to restrict this to pagination only.
If you have any ideas for other types of widgets let me know :-)
OK, thanks for your details. Are you thinking about to use https://github.com/browserstate/ajaxify instead files lib.js, jquery.ss.pagination.js, jquery.ss.endles.js, underscore.js?
Ajaxify seems to do something else: it replaces entire page, instead of fetching just the necessary snippet? So there is no potential to hook up PJAX, and also all DOM in the body is reloaded.
On the other hand it's a nice improvement which covers all possible scenarios and makes everything AJAXy in one shot :-) I'll think about how this could be incorporated.