Customize jBackapp for K2 items
-
remroc
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 2
-
Thank you received: 0
-
-
9 years 4 months ago - 9 years 4 months ago #4051
by remroc
Hello,
Many thanks for jbackend solution.
I have tried successfully the jbackapp and i wonder how to customize it to display in it the k2 items content ?
Thanks for your help.
Let me know if you need more details.
Remi
Last edit: 9 years 4 months ago by remroc.
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
9 years 4 months ago #4054
by admin
It's not so difficult (you need a little knowledge of Angular.js).
1) Edit the www/js/services.js and change the endpoints from Joomla categories and articles to K2 categories and items:
var feeds = {
section_a: "http://www.support4joomla.com/jbackend/rest/get/content/articles?catid=64&maxsubs=2&limit=10&orderby=id&orderdir=desc",
section_b: "http://www.support4joomla.com/jbackend/rest/get/content/articles?catid=26&maxsubs=2&limit=10&orderby=id&orderdir=desc",
section_c: "http://www.support4joomla.com/jbackend/rest/get/content/articles?catid=29&maxsubs=2&limit=10&orderby=id&orderdir=desc"
};
var content = "http://www.support4joomla.com/jbackend/rest/get/content/articles/"
2) Edit the www/js/controllers.js and change the SectionsCtrl controller to grab data from the new JSON response:
$scope.successGetSectionContent = function(data) {
$scope.maxIntro = 100;
$scope.items = data.articles;
for (var i = 0; i < $scope.items.length; i++) {
$scope.items[i].content = $scope.items[i].content.replace(/<[^>]+>/gm, '');
if ($scope.items[i].content.length > $scope.maxIntro) {
$scope.items[i].content = $scope.items[i].content.substr(0, $scope.maxIntro) + '...';
}
}
};
3) Change the sections and content views under www\templates the show new fields.
That's all.
Kind regards,
Luigi
Please Log in or Create an account to join the conversation.
-
remroc
-
Topic Author
-
Offline
-
New Member
-
Less
More
-
Posts: 2
-
Thank you received: 0
-
-
9 years 4 months ago - 9 years 4 months ago #4059
by remroc
Thanks Luigi for your answer.
I was able to change main.js and feed.js with your info (I haven't found controller.js and services.js). And it worked
Thanks
Can you precise how to create a flow like (user register, then login then get access to registered content) ?
Thank you again for this brillant contribution to Joomla community,
Brgds,
Remroc
Last edit: 9 years 4 months ago by remroc.
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
9 years 4 months ago #4062
by admin
Hi Remroc,
I am happy you were able to change it as by your needs.
About your question, I don't know, it really depends on what you need to do. Usually the most content is free to access, and there is some content restricted to registered users only. In this case the typical scenario, that is a mandatory login screen as first view, is not the best option in my opinion. You should grant access to content and provide a login button. When the user is authenticated, he will be able to access to restricted content too.
But as I told you before, this is part of the app design process ...
Kind regards,
Luigi
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 36
-
Thank you received: 0
-
-
9 years 2 weeks ago #4432
by alphaa
Bonjour,
S'il vous plait, comment trouver le response json pour pouvoir changer complétement le "controller.js" pour afficher mes articles K2.J'utilise "POSTMAN".
Merçi
Please Log in or Create an account to join the conversation.
Less
More
-
Posts: 3194
-
Thank you received: 441
-
-
Time to create page: 0.152 seconds