Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple config.js files #107

Open
jeremylynch opened this issue Dec 13, 2013 · 3 comments
Open

Multiple config.js files #107

jeremylynch opened this issue Dec 13, 2013 · 3 comments

Comments

@jeremylynch
Copy link

I want to implement two versions of the Redactor text-editor in my rails app with different config files. How can this be achieved?

@jeremylynch
Copy link
Author

I found a temporary solution by determining the controller from the url path all with jquery. Once the controller is determined,

function Getcontroller() {
  var controller = window.location.pathname.split('/')[1];
  return controller
}


$(document).ready(function() {
  controller = Getcontroller()
  if (controller == 'users') {
    config_1()
  } else {
    config_2()
  }
});

function config_1() {
  redactor config_1 here
}



function config_2() {
  redactor config_2 here
}

@marslo
Copy link

marslo commented Dec 18, 2013

How can I use two different configs in one Controller? For example, one for post, and another for comment.

@asecondwill
Copy link

untested, but could you not have a different class identifying the textarea and two different JS calls to redactor them:

$('.redactor-simple').redactor(
    {    
      buttons: [ 'formatting', 'bold', 'italic', 'unorderedlist','orderedlist','link','underline']
    }
  );

$('.redactor-really-simple').redactor(
    {    
      buttons: [ 'underline']
    }
  );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants