× Requests and support related to jBackend.

Customize jBackapp for K2 items

  • remroc
  • Topic Author
  • Offline
  • New Member
  • New Member
More
9 years 4 months ago - 9 years 4 months ago #4051 by remroc
Customize jBackapp for K2 items was created 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.

More
9 years 4 months ago #4054 by admin
Replied by admin on topic Customize jBackapp for K2 items
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
  • New Member
More
9 years 4 months ago - 9 years 4 months ago #4059 by remroc
Replied by remroc on topic Customize jBackapp for K2 items
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 :D

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.

More
9 years 4 months ago #4062 by admin
Replied by admin on topic Customize jBackapp for K2 items
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.

More
9 years 2 weeks ago #4432 by alphaa
Replied by alphaa on topic Customize jBackapp for K2 items
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.

More
9 years 2 weeks ago #4433 by admin
Replied by admin on topic Customize jBackapp for K2 items
Hi,
you just need to change the requests and change the fields parsed in the response. Documentation can be found here:

www.selfget.com/documentation/jbackend-joomla30/k2-module-api.html

Kind regards

Please Log in or Create an account to join the conversation.

Time to create page: 0.160 seconds