Jump to content
apeisa

Fredi - friendly frontend editing

Recommended Posts

Wohoo apeisa hws a new baby! Great to have this!

  • Like 1

Share this post


Link to post
Share on other sites

Hahaa, thanks Soma :) It has little bugs with images/files and haven't even tested it with repeater yet, but other than that it seems to work nicely! This was superfun to code and actually took very little time and code so far.

Share this post


Link to post
Share on other sites

Let pw do its work and youll be fine. :)

Just have to remember to echo it!

Btw what about permissions?

Share this post


Link to post
Share on other sites

Permissions should be fine. I check them on field level.

Marty: feel free to try. I think it might work with thumbnails already. If not, it shouldn't be a big tweak.

  • Like 1

Share this post


Link to post
Share on other sites
Btw what about permissions?

Oh, I had nice bug that showed edit links for everyone (and then login screen if user didn't have editing rights). Fixed now, show edit links are shown only for editors.

Share this post


Link to post
Share on other sites

Ok, just pushed nice little update. It should support pretty much all inputfields now (uses their native input processing). Only thing where I am having problems is ajaxfiles inside repeater (gives me response text: "page not saved (no changes)" after upload has been done). Repeaters without images works just fine.

It should be pretty trivial to build some kind of JS-switch to "show / hide" edit buttons. There is also $fredi->enabled = false that you can set if you want to disable edit links for some reason.

  • Like 1

Share this post


Link to post
Share on other sites

Uh nice,

a lot of little cupcakes inside your code to pick and learn from.

  • Like 1

Share this post


Link to post
Share on other sites

Apeisa i think you have to set some track changes when modifiying repeaters. Am on mobile so cant look.

Share this post


Link to post
Share on other sites

Thanks soma. That is what I have tried, not lucky yet.

Share this post


Link to post
Share on other sites

Does it works with language fields? Because all I get is a "edit" text instead of the body and a edit link.

Share this post


Link to post
Share on other sites

Haven't tested yet. Does it work with others? You have loaded js?

Share this post


Link to post
Share on other sites

Yes I have scripts. I get the link only with no text and if I click it just loads the homepage in the modal.

<span onclick="TINY.box.show({iframe:'http://pwmultilang.ch?id=1001&fields=body&modal=1',boxid:'frediModal',width:750,height:450,fixed:true,maskid:'bluemask',maskopacity:40})" class="fredi fredi-body">edit</span>

Share this post


Link to post
Share on other sites

I also just tested with a non language field and same issue as above. I don't know what is wrong.

Share this post


Link to post
Share on other sites

The url seems to be wrong. Do you have the process module installed? Does this selector work for you: wire('pages')->get("template=admin, name=fredi-field-edit");

Share this post


Link to post
Share on other sites

I just tried on a non language install, and got same issue.

Thanks, yeah it seems the process module doesn't get installed at all. Although it says it installs it, it doesn't.



I installed the proces module and now the edit link works and opens field, but the text still isn't shown/rendered on page...

Share this post


Link to post
Share on other sites

Multilang fields: it has few issues. It shows all languages right, but saves the "default" into "active" language. So if you are currently browsing with default lang, it discards all the changes for alternative languages. If you are browsing in alternative language, it saves default value into it.

Share this post


Link to post
Share on other sites

I'm on a other install with no languages. Still doesn't output the body text when using echo $fredi->body. Just the edit link.

Share this post


Link to post
Share on other sites

I just tried on a non language install, and got same issue.

Thanks, yeah it seems the process module doesn't get installed at all. Although it says it installs it, it doesn't.

That is strange. It is listed as "installs" module, so PW should take care of it. Bug in core or something strange on my install method?

I installed the proces module and now the edit link works and opens field, but the text still isn't shown/rendered on page...

Which text is not shown and where? Editor doesn't load value when editing.

I'm on a other install with no languages. Still doesn't output the body text when using echo $fredi->body. Just the edit link.

Oh, it shouldn't :)

$fredi->body outputs just the link, you render the content yourself with $page->body. This allows you to put the link wherever you like.

Share this post


Link to post
Share on other sites

The body text isnt shown on the page just an edit link instead of the body text.

Ah now I get iz. Think it wasnt too clear about from your example.

Share this post


Link to post
Share on other sites

That is strange. It is listed as "installs" module, so PW should take care of it. Bug in core or something strange on my install method?

Well, the process module doesn't have diabled install button so something is wrong.. :)

ProcessFredi and FrediProcess are different modules, so it can't work ;)

  • Like 1

Share this post


Link to post
Share on other sites

Well, the process module doesn't have diabled install button so something is wrong.. :)

ProcessFredi and FrediProcess are different modules, so it can't work ;)

Oh boy :) Thanks for this.

I have few tweaks coming, so will commit that fix with those.

Ah now I get iz. Think it wasnt too clear about from your example.

I added extra note for this case. Also will make better examples for official readme that is currently baking.

Share this post


Link to post
Share on other sites

Multilang fields should work now too and also fixed the problem with installation.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By gebeer
      Although the PW backend is really intuitive, ever so often my clients need some assistance. Be it they are not so tech savvy or they are not working in the backend often.
      For those cases it is nice to make some help videos available to editors. This is what this module does.
      ProcessHelpVideos Module
      A Process module to display help videos for the ProcessWire CMS. It can be used to make help videos (screencasts) available to content editors.
      This module adds a 'Help Videos" section to the ProcessWire backend. The help videos are accessible through an automatically created page in the Admin page tree. You can add your help videos as pages in the page tree. The module adds a hidden page to the page tree that acts as parent page for the help video pages. All necessary fields and templates will be installed automatically. If there are already a CKEditor field and/or a file field for mp4 files installed in the system, the module will use those. Otherwise it will create the necessary fields. Also the necessary templates for the parent help videos page and it's children are created on module install. The module installs a permission process-helpvideos. Every user role that should have access to the help video section, needs this permission. I use the help video approach on quite a few production sites. It is stable so far and well received by site owners/editors. Up until now I installed required fields, templates and pages manually and then added the module. Now I added all this logic to the install method of the module and it should be ready to share.
      The module and further description on how to use it is available on github: https://github.com/gebeer/ProcessHelpVideos
      If you like to give it a try, I am happy to receive your comments/suggestions here.
    • By Robin S
      A module created in response to the topic here:
      Page List Select Multiple Quickly
      Modifies PageListSelectMultiple to allow you to select multiple pages without the tree closing every time you select a page.
      The screencast says it all:

       
      https://github.com/Toutouwai/PageListSelectMultipleQuickly
      https://modules.processwire.com/modules/page-list-select-multiple-quickly/
    • By gebeer
      Hello all,
      sharing my new module FieldtypeImagePicker. It provides a configurable input field for choosing any type of image from a predefined folder.
      The need for it came up because a client had a custom SVG icon set and I wanted the editors to be able to choose an icon in the page editor.
      It can also be used to offer a choice of images that are used site-wide without having to upload them to individual pages.
      There are no image manipulation methods like with the native PW image field.
      Module and full description can be found on github https://github.com/gebeer/FieldtypeImagePicker
      Kudos to @Martijn Geerts. I used his module FieldTypeSelectFile as a base to build upon.
      Here's how the input field looks like in the page editor:

      Hope it can be of use to someone.
      If you like to give it a try, I'm happy to hear your comments or suggestions for improvement. Eventually this will go in the module directory soon, too.
    • By bernhard
      @Sergio asked about the pdf creation process in the showcase thread about my 360° feedback/survey tool and so I went ahead and set my little pdf helper module to public.
      Description from PW Weekly:
       
      Modules Directory: https://modules.processwire.com/modules/rock-pdf/
      Download & Docs: https://github.com/BernhardBaumrock/RockPDF
       
      You can combine it easily with RockReplacer: 
      See also a little showcase of the RockPdf module in this thread:
       
    • By ukyo
      FieldtypeFontIconPicker
      Supported Icon Libraries
      FontAwesome 4.7.0 Uikit 3.0.34 IonicIcons 2.0.1 Cahangelog
      NOTE: Module store data without prefix, you need to add "prefix" when you want to show your icon on front-end, because some of front-end frameworks using font-awesome with different "prefix".
      Module will search site/modules/**/configs/IconPicker.*.php and site/templates/IconPicker.*.php paths for FieldtypeFontIconPicker config files.
      All config files need to return a PHP ARRAY like examples.
      Example config file : create your own icon set.
      File location is site/configs/IconPicker.example.php
      <?php namespace ProcessWire; /** * IconPicker : Custom Icons */ return [ "name" => "my-custom-icons", "title" => "My Custom Icon Set", "version" => "1.0.0", "styles" => array( wire("config")->urls->templates . "dist/css/my-custom-icons.css" ), "scripts" => array( wire("config")->urls->templates . "dist/js/my-custom-icons.js" ), "categorized" => true, "attributes" => array(), "icons" => array( "brand-icons" => array( "title" => "Brand Icons", "icons" => array( "google", "facebook", "twitter", "instagram" ) ), "flag-icons" => array( "title" => "Flag Icons", "icons" => array( "tr", "gb", "us", "it", "de", "nl", "fr" ) ) ) ]; Example config file : use existing and extend it.
      File location is site/configs/IconPicker.altivebir.php
      <?php namespace ProcessWire; /** * IconPicker : Existing & Extend */ $resource = include wire("config")->paths->siteModules . "FieldtypeFontIconPicker/configs/IconPicker.uikit.php"; $url = wire("config")->urls->templates . "dist"; $resource["scripts"] = array_merge($resource["scripts"], ["{$url}/js/Altivebir.Icon.min.js"]); $resource["icons"]["flag-icons"] = [ "title" => "Flag Icons", "icons" => array("tr", "en", "fr", "us", "it", "de") ]; $resource["icons"]["brand-icons"]["icons"] = array_merge($resource["icons"]["brand-icons"]["icons"], array( "altivebir" )); return $resource; After you add your custom config file, you will see your config file on library select box. Library Title (Location Folder Name).

      If your library categorized and if you have categorized icons set like uikit and fontawesome libraries, you will have category limitation options per icon field or leave it empty for allow all categories (default).

      Example : output
      if ($icon = $page->get("iconField")) { echo "<i class='prefix-{$icon}' />"; } MarkupFontIconPicker Usage
      // MarkupFontIconPicker::render(YourIconField=string, Options=array) echo MarkupFontIconPicker::render($page->YourIconField, [ 'prefix' => 'uk-icon-', // Icon class prefix, if you have different prefix, default is : "fa fa-" 'tag' => 'span', // Icon tag default is : "i" 'class' => 'fa-lg', // If you have extra cutom classes, for example : icons sizes, Array or Sting value 'style' => 'your custom styles if you have' // Array or String Value ]); Theme support

      Search support

      Category support

       
×
×
  • Create New...