orionjs / orioncms

[Old] Orion is an open source framework built on Meteor that makes complex as well as simple apps possible with minimal effort.
http://orionjs.org
MIT License
715 stars 129 forks source link

[Flow-Router] Update Page Administration Broken #370

Closed dotgreg closed 8 years ago

dotgreg commented 8 years ago

Hello Guys, so first I want to thank for that awesome framework.

I am starting with Orion and I am unable to make the administration for a page update working. I precise that I can access normally to the administation and all of the functionnalities, including the page creation and pages listing.

There are no errors in the logs or console in the browser. I am developing on windows 8.1, meteor 1.2.1, tested on chrome 46.0.2490.86 m and firefox 42.0

Here is my (very minimal) code to reproduce the bug :

    orion.pages.addTemplate ({
    layout: 'layout',
    template: 'page',
    name: 'page',
    description: 'page'
    }, {
    content: {
        type: String,
        label: 'description'
    }
});

if (Meteor.isClient) {
    Template.layout.onRendered(function() {
        this.subscribe('pages');
    });
}

if (Meteor.isServer) {

}

My packages :

orionjs:core
aldeed:simple-schema
aldeed:collection2
kadira:flow-router
kadira:blaze-layout
orionjs:pages
orionjs:bootstrap
twbs:bootstrap
fortawesome:fontawesome 

and the result on the admin (update interface not showing the form, sorry cannot embed the picture as it is my first post here)

(everything else is good)

Am I missing something? Thanks!

dotgreg commented 8 years ago

UPDATE : I changed the router from flow-router to iron-router and it is working now.

It looks coming from the flow-router integration

nicolaslopezj commented 8 years ago

This is working for me with flow router. Are you still having this error?

sean-stanley commented 8 years ago

+1 I have this issue as well but can't test your fix as its on the 1.8 branch and I can only get 1.7 from atmosphere. Also, My issue is occurring using materialize not bootstrap. Will your change address the issue on the materialize theme as well as the bootstrap theme?

rwatts3 commented 8 years ago

Here is a tentative fix until you update to 1.8 . Usually when I come across small issues like this in between version updates. I place the updated code in my /orion/admin/ folder. Then simply paste the fix in either isClient or isServer conditional.

It's a good way to manage small tweaks to your app while waiting for the next version. Thank God Nick used ReactiveTemplates, otherwise this would be a huge pain.

if(Meteor.isClient){
    ReactiveTemplates.onCreated('pages.update', function() {
      var self = this;
      self.autorun(function() {
        self.subscribe('pageById', RouterLayer.getParam('_id'));
      });
    });

    ReactiveTemplates.helpers('pages.update', {
      getSchema: function() {
        var item = orion.pages.collection.findOne(RouterLayer.getParam('_id'));
        return item && orion.pages.templates[item.template] && orion.pages.templates[item.template].schema;
      },

      item: function() {
        return orion.pages.collection.findOne(RouterLayer.getParam('_id'));
      },
    });
}
sean-stanley commented 8 years ago

I made a pull request where actually just a small change to the template made it work again for me.

amorist commented 8 years ago

I have one question need ur kind answer, why the Orion page cannot get updated? i can post the page and also can read it But I cannot update it

amorist commented 8 years ago

screen shot 2016-04-08 at 1 43 10 pm screen shot 2016-04-08 at 1 43 26 pm

mmazloum commented 8 years ago

Same Trouble as described, using Kadira Flow Router and orion 1.8 shows same behaviour the form doesn't load data when I re-open it however I can see the data in MongoDB. Data is not available on the template side too.

The framework is still great thanks a lot.

mmazloum commented 8 years ago

If I may the delete button doesn't work either.

masca88 commented 8 years ago

+1 I've the same problem and I'm with iron-router

BenjaDev commented 8 years ago

+1 same here. First used flow-router, nether updating nor deleting worked. When I wanted to update, no error in console appeared, when I wanted to delete a page, an error appeared There is no route for the path: /admin/pages/delete . Now with iron-router I actually can update a page, but not deleting, no error appears if i try to.

ogermann commented 8 years ago

+1 same issue here with flow-router and bootstrap.

ogermann commented 8 years ago

I found a solution for me: I updated the template for "orion.pages.update" from

{{> quickForm collection="orion.pages.collection" schema=getSchema doc=this id="orionPagesUpdateForm" type="update" buttonContent=false }}

to

{{> quickForm collection="orion.pages.collection" schema=getSchema doc=item id="orionPagesUpdateForm" type="update" buttonContent=false }}

And it works. Well, deleting an tiem is still impossible but this can be solved easily i guess.

I hope this will help some of you guys.