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

Alright! I can't wait to try this Antti. Quick question: will it let me work with your Thumbnails module too?

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

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


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Robin S
      Checkbox Reversed
      Modifies InputfieldCheckbox so that it shows the reverse of its true value. The checkbox will be unchecked when the field value is 1 and checked when the field value is not 1.
      Background
      The core FieldtypeCheckbox does not have a setting that allows a checkbox to be checked by default. One reason for this is that only a checked field saves a value to the database. An unchecked field does not save "0" to the database, but rather does not save any value for the field at all. Therefore there is no way to distinguish between a new field that has not yet been saved (and therefore could potentially get a default checked state) and a field that has deliberately been saved as unchecked.
      Because of this you sometimes have to use a checkbox in the opposite way than you would like. Suppose your client has requested a checkbox labelled "Bootylicious" that will be checked by default. This isn't possible with FieldtypeCheckbox so instead you have to convince them that a checkbox labelled "Not bootylicious" that is unchecked by default is just as good. This alternative will achieve the same thing, but it's not ideal.
      A solution
      This module doesn't change the limitations of the core checkbox field, but it provides a workaround that allows you to show the checkbox with the desired default state and label. So in the example above you would still name the field "not_bootylicious" (otherwise it could get confusing in your template files) but you can label the field "Bootylicious" and the checkbox will appear checked when its true value is actually unchecked, and vice versa. This allows new pages to show the checkbox checked by default. Clear as mud?
      Usage
      Install the Checkbox Reversed module.
      For any Checkbox field where you want the inputfield to show the reverse of its true value, activate the "Reverse the checked state of this inputfield?" option in the field settings.

       
      https://github.com/Toutouwai/CheckboxReversed
      http://modules.processwire.com/modules/checkbox-reversed/
    • By louisstephens
      I have been following @bernhard's great tutorial on creating a Dashboard and everything has very easy to understand so far. However, I need to add a select field that a template is using (so users can create a new page from the dashboard), but I am really at a complete lost on how to achieve this. I have been googling, but can't really find anything on the matter.
      $field = $this->modules->get('InputfieldSelect'); $field->name = "Select Manufacturer"; $field->findPagesSelector = "template=basic-page"; //not needed for select field $field->labelFieldName = "title"; $field->name = "Manufacturer Select"; $field->columnWidth = 34; $fieldset->add($field); I have the above code, which was originally an InputfieldPage, but since this is an options field, I have changed it. Has anyone actually gotten a select from a template (and its' values) in a module?
    • By Lex Sanchez
      Video or Social Post Embed
      Based on the TextformatterVideoEmbed module developed by Ryan Cramer, we have added the possibility to embed publications of the main social networks Facebook, Twitter and Instagram.
      ProcessWire Textformatter module that enables translation of YouTube, Vimeo, Instagram, Facebook, Twitter or Issuu URLs to full embed codes, resulting in a viewable video or social post in textarea fields you apply it to.
      How to install
      Download or Clone from Github: https://github.com/lexsanchez/VideoOrSocialPostEmbed
      Copy the VideoOrSocialPostEmbed.module file to your /site/modules/ directory (or place it in /site/modules/VideoOrSocialPostEmbed/).
      Click check for new modules in ProcessWire Admin Modules screen. Click install for the module labeled: "Video or Social Post Embed".
      Now you will be on the module config screen. Please make note of the config options and set as you see fit.
      How to use
      Edit your body field in Setup > Fields (or whatever field(s) you will be placing videos in). On the details tab, find the Text Formatters field and select "Video or Social Post Embed". Save.
      Edit a page using the field you edited and paste in YouTube, Vimeo, Facebook, Twitter, Instagram and/or Issuu URLs each on their own paragraph.
      Example
      How it might look in your editor (like TinyMCE):
      How it works
      This module uses YouTube, Vimeo, Instagram, Facebook, Twitter and Issuu oEmbed services to generate the embed codes populated in your content. After these services are queried the first time, the embed code is cached so that it doesn't need to be pulled again.
      Configuration
      You may want to update the max width and max height settings on the module's configuration screen. You should make these consistent with what is supported by your site design.
      If you change these max width / max height settings you may also want to check the box to clear cache, so that YouTube/Vimeo/Facebook/Twitter/Instagram/Issuu oembed services will generate new embed codes for you.
      Using with Markdown, Textile or other LML
      This text formatter is looking for a YouTube, Vimeo, Instagram, Facebook, Twitter or Issuu video URL surrounded by paragraph tags. As a result, if you are using Markdown or Textile (or something else like it) you want that text formatter to run before this one. That ensures that the expected paragraph tags will be present when VideoOrSocialPostEmbed runs. You can control the order that text formatters are run in by drag/drop sorting in the field editor.
      Copyright 2018 by Ryan Cramer / Updated by Lex Sanchez
    • By kixe
      Email Verification
      This module provides functions to validate email adresses and hosts. The module generates a textfile for blacklisted mailhosts (trashmail), which will be always up to date.
      Download
      https://modules.processwire.com/modules/email-verification/
      API
      // get module $mailcheck = $modules->get('EmailVerification'); // return bool/ string - automatted update of blacklist file $mailcheck->blacklisted(email|domain) // return bool - validate a top level domain, checks against IANA list $mailcheck->validTLD(tld) // return array of punycoded TLDs - cyclic updated, data pulled from IANA $mailcheck->getTLDs(cycle=2592000) // return bool - checks syntax converts to punycode $mailcheck->validDomainName(domain); // return bool - checks punycode encoded syntax $mailcheck->validHostName(host); // return bool - checks syntax and accessibility $mailcheck->validHost(email|domain) // add a single value to blacklist $mailcheck->addToBlacklist(email|domain) USAGE
      $mailcheck = $modules->get('EmailCheck'); $email = 'susi@trashmail.com'; if($mailcheck->blacklisted($email)) echo 'Email Provider not allowed'; if(!$mailcheck->validHost($email)) echo 'Mailhost not available'; Example blacklist file:  blacklist.txt