Jump to content

Fredi - friendly frontend editing


apeisa

Recommended Posts

Martin thanks for your answer. In the first case where I get the link plus the modal window with all the fields here the changes get recorded. In the second issue when I m not logged with the superuser. There u don't see the edit link. But with that same user, if log in in admin I can make change to the users because I gave that role the right to modify users. You think in that case there could be some different control applied from the front end?

Link to comment
Share on other sites

  • 2 weeks later...

Could there be a problem if i call fredi more than once on a page?

PW dev 2.6.13 - debug mode on - actual fredi

on all templates i use fredi for the whole page like this:

<?php //in <head>
if($page->editable() && $user->isLoggedin()) {
	echo $fredi->renderScript();
}
?>

<?php //in <body>
if($page->editable() && $user->isLoggedin()) {
	echo $fredi->setText("Edit")->hideTabs("children|delete|settings|history")->renderAll();
}
?>

and in one template where i render events - i want to edit the single events - and since i have no "single-event-view" and only the "events" page i've tryed to render Fredi within the loop on every event item like this:

	//get all events and render list - events is set in events.php
	foreach ($events as $e) {
                //some markup and vars....

		//create event html output
		echo '<article class="tline-box '.$class.'"> <span class="'.$span.'"></span><br>';
			//if editable show editlink to the event page
			if($page->editable() && $user->isLoggedin()) {
				echo $fredi->setText("Edit")->hideTabs("children|delete|settings|history")->renderAll($e);
			}

			//rest of markup....

and it works like it should so far - but it doesn't save the changes?

- generated link points to the right page_id's

- popup edit modal shows the right entry

- could easy edit all things

but at the end the event isn't changed - no error - no hint?

wrong token, id, pageobject i've no glue?

Best regards mr-fan

Link to comment
Share on other sites

i forgot a nice to know.

the first renderFredi link on the whole page don't save simple changed on the events page, too!

so every fredi link get's renders correct - but no one seems to save the changes...so not only the links on the different events don't work the fredi link that works on all other pages like it should didn't work on this page where i've more than one fredi link....

Link to comment
Share on other sites

OK i figured it out while reducing the options....

so this wont work:

$fredi->setText("Edit")->hideTabs("children|delete|settings|history")->renderAll($e);

while this works:

$fredi->setText("Edit")->hideTabs("children|delete|settings")->renderAll($e);

it was the history tab that cases the no-data-saved problem.

This tab is generated from the version control module....so i will have to take a look into hiding this tab somewhere else or change fredi.

so this is solved - sorry for fast posting before better researching...

Best regards mr-fan

Link to comment
Share on other sites

Hi there. New to PW but plenty of other CMS experience. Loving PW so far so thank you folks!

I've installed Fredi on PW 2.6.1 and using it to create and modify pages just fine. The plan is to let 'front end' users add, modify and delete their own adverts to a site that I'm building.

It's all working as planned except the follow up when deleting a page. On clicking the delete tab, checking the confirmation box and finally clicking 'Delete Permanently' the modal confirms (admin style) that the page has moved to trash and then shows the page tree within the modal. As this is a front end delete I'd really like the modal to close and return to a certain page at that point (e.g. a list of the users other adverts).

So, my question is...is the page tree view after delete expected behaviour or am I doing something wrong?

Code for delete button as I'm using it is:

echo $fredi->hideTabs("content|children|settings")->setText("Delete This Advert")->setClass("btn btn-primary")->render("title|vendor|price|body|page_image");

Many thanks in advance. Have already learned a huge about about PW from everyones helpful posts!

  • Like 1
Link to comment
Share on other sites

Hello @ all

As I wrote in an earlier post (https://processwire.com/talk/topic/3265-fredi-friendly-frontend-editing/?p=100192): Fredi doesnt grab or save files or images if they are inside a repeater field - can anyone confirm this behavior or ist this only in my case?

If the file type field or image type field is outside the repeater field and the settings are on multiple files it is not a problem.

Strange behaviour: If I call a page via a pagetable field it always grabs and saves the file/image in a repeater field

Best regards.

Link to comment
Share on other sites

Hi,

I'm new to PW and recently I discovered »Fredi«. This is really a cool feature, especially with all those additional options. 

I installed it, everything works fine, but the backend page doesn't open in a lightbox as shown in the screenshots and some screencasts. When I click on »Edit« I'm directed to my backend. After changing the content and clicking on »Save« I have to use the back arrow from the browser to go back to the front-end.

Is this a normal situation?

Nikolai

Link to comment
Share on other sites

How can I prevent the redirect when I add a new page with the Fredi Module?

Here is my Code-Snippet:

$fredi->setText("<i class='fa fa-plus'></i> $page->title erfassen")->addPage("user", "title|pass|email|roles|admin_theme|select_organiser|language", $pages->get(29));
Edited by LostKobrakai
Merged into support topic
Link to comment
Share on other sites

  • 1 month later...

hi,

Coming back on the issue I raised in a post above regarding using Fredy to edit users.

Just wanted to say that the permission control problem I mentionned above (ie edit field not appearing for user with a edit role for that page). Isn't  occuring anymore. I don't know what I did differently but it's working now. Sorry for this.
However the first problem I was mentioning is still there : in a form to edit a user profile, I can't target the fields I want in the edit form.  with this: echo $fredi->email($student); I get a form with all the fields of the template. If I test the same on a page (not from the user template) it works fine the modal only displays the fields I targeted.
Any clue ?

I am running this on the latest dev (PW2.6.21, php 5.4.42). 

Link to comment
Share on other sites

  • 4 weeks later...

I found a problem saving changes with fredi.

I have the settings-tab hidden. The page has the hidden-flag on. After saving my changes to some text-fields with fredi, the hidden-flag is automatically set off.

If I set the settings-tab visible, the hidden-flag doesn't change its status on save. 

Fredi is version 1.2.0 and PW 2.6.21.

Link to comment
Share on other sites

  • 1 month later...

Hi all,

PW: 2.7.2

Fredi: 1.2.0

Fredi working great on pages for me but not for $user :-(

I have a page called 'My Profile' on the front-end of a site. The page is access controlled so that only a logged in user can see it and, thus, the logged in $user can see their own info. Other than that it's a normal content page that echos various parameters (name, address, email etc.) that are assigned to the logged in user.

Heres an example of what's on that page (this works):

echo "<span>Your company name: </span>" . $user->user_company_name . "<br />";

I'd like to add a link on this page to call a Fredi modal to change the users own info. So, I call this:

echo $fredi->renderAll($user); 

(I'll edit settings on the Fredi call to set link text, field to edit etc later)

Sadly no link appears :-(

So, I added the following code into the page to see what permissions the logged in user had for their $user 'page':

foreach ($permissions as $perm) {
if ($user->hasPermission($perm, $user)) {
echo $perm->title . "<br />";
}
}
 
I get this (as expected based on permissions for template):
 
Edit an advert
Delete pages - (for adverts)
Edit pages
View pages
User can update profile/password
Administer users
 
Then I changed the second line of the code above to see what permissions the $user has for the actual page (rather for the $user):
 
if ($user->hasPermission($perm, $page)) {
 
I get the same permissions echoed.
 
So what am I doing wrong??? I can't get a Fredi link to edit the $user no matter what I do. I've even tried this when logged in as the superuser and still nothing.
 
Any help really appreciated. Thank you :-)
Edited by prestoav
Moved to the respective module's topic
Link to comment
Share on other sites

  • 1 month later...

Some of my users are reporting an issue where they click on the link to activate Fredi, and instead of getting the form in a dialog box, they are presented with just a blank dialog box (they see the spinner but then just a blank box). I can see further back in this thread that there was a similar issue a long time ago but I assume that has now been solved.  I've tried it on multiple devices and browsers here and have only managed to reproduce the problem once (on that occasion clearing the browser cache solved the problem but I've asked my users who have the problem to do this and in some cases it has solved the problem but in some cases the problem then recurs the next time they click the Fredi link.

Any thoughts on what might be going wrong are welcome.

My code to call fredi is:

 

<a onclick='fredi.modal("http://www.aaa.com/processwire/fredi-field-edit/?id=<?php echo $mypage->id; ?>&frediFields=title|post_description|linked_ruins|post_images|hashtag&hideTabs=children|delete|settings&modal=1"); return false;' 
														 href="http://www.aaa.com/processwire/fredi-field-edit/?id=<?php echo $mypage->id; ?>&frediFields=title|post_description|linked_ruins|post_images|hashtag&hideTabs=children|delete|settings&modal=1" >Click here to add a new image</a>

I've changed the domain name in the posted code as the site owners don't want their domain open to the public yet.

Link to comment
Share on other sites

  • 4 weeks later...

Hi, maybe someone tried this before me:

Do you think I could get fredi working inside hannacode?

I'm trying to use it as usual but I get an error message:

Error: Call to a member function render() on a non-object

$members = wire('pages')->find("parent=/members/, location=$office, include=hidden");
foreach ($members as $member) {
    echo $fredi->render('title|headline|mobile|mail', $member);

Without the fredi code everything works as expected.

Could anyone point me to the right direction? Obviously I must do something wrong. Thanks

Link to comment
Share on other sites

Hantzweb, hard to say, I have never seen that behavior. Let me know if you find a way to reproduce it.

Jozsef, you probably need to load Fredi wire("modules")->get("Fredi")

Thanks Apeisa, I had to add $fredi = wire("modules")->get("Fredi") to the hannacode even though it was in the template file too. It works now.

Link to comment
Share on other sites

Hi Guys,

First of, this is a great module! Realy nice :) But I have a few issues using this module and was wondering if you guys could help me out.

I implemented it using: 

$username = $user->name;
$another_page = $pages->find("template=user, name={$username}")->first;
echo $fredi->render("name|zzp_profiel_omschrijving", $another_page);

- This works perfectly when logged in as Admin, but not as a different user Role even though I added edit pages and edit profile

to it's permissions. The edit button disappears in it's entirety when I'm logged in as a Superuser.

- Also, this outputs all fields added to a user, not just the ones I specified ( name and zzp_profiel_omschrijving )

- Furthermore I was wondering if there is a way to embed the edit fields directly onto a page, without the edit buttons.

So you would just get a page on the fontend with the field of the backend?

Thanks a lot! :)

Gr Bram

Link to comment
Share on other sites

  • 3 weeks later...

Some of my users are reporting an issue where they click on the link to activate Fredi, and instead of getting the form in a dialog box, they are presented with just a blank dialog box (they see the spinner but then just a blank box). I can see further back in this thread that there was a similar issue a long time ago but I assume that has now been solved.  I've tried it on multiple devices and browsers here and have only managed to reproduce the problem once (on that occasion clearing the browser cache solved the problem but I've asked my users who have the problem to do this and in some cases it has solved the problem but in some cases the problem then recurs the next time they click the Fredi link.

Any thoughts on what might be going wrong are welcome.

My code to call fredi is:

<a onclick='fredi.modal("http://www.aaa.com/processwire/fredi-field-edit/?id=<?php echo $mypage->id; ?>&frediFields=title|post_description|linked_ruins|post_images|hashtag&hideTabs=children|delete|settings&modal=1"); return false;' 
														 href="http://www.aaa.com/processwire/fredi-field-edit/?id=<?php echo $mypage->id; ?>&frediFields=title|post_description|linked_ruins|post_images|hashtag&hideTabs=children|delete|settings&modal=1" >Click here to add a new image</a>

I've changed the domain name in the posted code as the site owners don't want their domain open to the public yet.

Hantzweb - did you ever resolve the issue with users seeing blank modal? I'm getting the same thing reported now the development site has moved to a www domain rather than the dev one. They (3 users) were seeing it OK on the dev domain but now just get a blank modal when they click to edit.
 
Sadly I can't replicate the issue on any browser here but three independent users have he same issue so I know it's real!
 
The only pointer I have so far is a report of 'Publisher does not allow it to be displayed in a frame' on IE. This looks like an x-frame-options issue from a bit of Googling, possibly in my case after the domain move?
Link to comment
Share on other sites

Hantzweb - did you ever resolve the issue with users seeing blank modal? I'm getting the same thing reported now the development site has moved to a www domain rather than the dev one. They (3 users) were seeing it OK on the dev domain but now just get a blank modal when they click to edit.
 
Sadly I can't replicate the issue on any browser here but three independent users have he same issue so I know it's real!
 
The only pointer I have so far is a report of 'Publisher does not allow it to be displayed in a frame' on IE. This looks like an x-frame-options issue from a bit of Googling, possibly in my case after the domain move?

OK, I think I found the problem for my installation. The browser was remembering the password even though the site had been moved between two sub domains (from a dev.mydomain.com to a www.mydomain.com). We needed to delete browsing history, cookie and passwords from the browser before the modal displayed again. This was true in Chrome on Windows and Safari on a Mac.

>>> UPDATE <<<

I thought I'd cracked this but apparently not. A completely new user this morning has the same issue in Both Chrome and Firefox on a Win 7 PC. :-(

Link to comment
Share on other sites

  • 9 months later...

Hi everyone,

I'm using Fredi to let users add advert to a site. It works fine for adding/editing pages but how can I get it to accept images uploaded in one step?
The page must be saved first so the image is not saved when the user saves the page the first time.

Any tips? Maybe a two step process? Tabs? I'm in the dark...

Link to comment
Share on other sites

Hi everyone,

I'm using Fredi to let users add adverts to a site. It works fine for adding/editing pages but how can I get it to accept images uploaded in one step?
The page must be saved first so the image is not saved when the user saves the page the first time.

Any tips? Maybe a two step process? Tabs? I'm in the dark…

I'm using this code that works great for adding the page, but how to hook into save the page before the user uploads an image?

 $fredi = $modules->get("Fredi");
 $content .= $fredi->setText("Sell a dress")->setClass("link-button")->addPage("dress", "title|body|images|price|brand|colour|size|condition|length|style|contact|phone|email|county", $pages->get(1243));

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...