Git Product home page Git Product logo

Comments (9)

iquiw avatar iquiw commented on June 12, 2024 1

It is okay to have a pull request in the current state.

Submitted PR.

I'll take care of the rest.

Thank you so much!!

from redmine-view-customize.

onozaty avatar onozaty commented on June 12, 2024 1

Released at v2.8.0.

Thanks!

from redmine-view-customize.

onozaty avatar onozaty commented on June 12, 2024

Thank you for your feature request.

What you want to do may be possible without additional features.
With the window load event, you'd be able to run it after the Gantt chart script.

$(window).on('load', function() {
  // your scripts
});

This is because the window load event occurs after $(function{}).

Would you please give it a try?
If you can't get around it here, we'd like to add a feature.

from redmine-view-customize.

iquiw avatar iquiw commented on June 12, 2024

Thanks!

I've tried it, but no success.
Actually, it worked with RedMica v1.1, but not works with RedMica v1.2.

I will try again and paste the script here later.

Anyway, I am trying to implement it...
https://github.com/iquiw/redmine-view-customize/tree/body-bottom

from redmine-view-customize.

onozaty avatar onozaty commented on June 12, 2024

Thanks for trying.

If the load event doesn't work, it may not work even if you use View customize to handle it.

from redmine-view-customize.

iquiw avatar iquiw commented on June 12, 2024

Here is the script, which saves and restores Gantt chart subject column width.

// https://stackoverflow.com/a/2523758
$.widget("ui.resizable", $.ui.resizable, {
  resizeTo: function(newSize) {
    let start = new $.Event("mousedown", { pageX: 0, pageY: 0 });
    this._mouseStart(start);
    this.axis = 'se';
    let end = new $.Event("mouseup", {
      pageX: newSize.width - this.originalSize.width,
      pageY: newSize.height - this.originalSize.height
    });
    this._mouseDrag(end);
    this._mouseStop(end);
  }
});

$(window).on('load', function() {
//$(function() {
  const GANTT_SUBJECT_WIDTH_KEY = 'redmine-gantt-subject-width';
  let $subject = $('.gantt_subjects_column.ui-resizable');
  $subject.resizable({
    stop: function(event, ui) {
      localStorage.setItem(GANTT_SUBJECT_WIDTH_KEY, ui.size.width);
    }
  });
  let width = localStorage.getItem(GANTT_SUBJECT_WIDTH_KEY);
  if (width) {
    $subject.resizable('resizeTo', { width: width, height: $subject.height() });
  }
});

As far as I tried the following combinations with RedMica v1.2,

  • Browser: Chrome/Firefox
  • Position: Head of all pages/Bottom of all pages
  • Load: $(window).on('load'/$(function()

With Chrome, it works in the following cases.

Head of all pages Bottom of all pages
$(window).on('load' O O
$(function() X O

With Firefox, it works only when using $(function() and Bottom of all pages.

Head of all pages Bottom of all pages
$(window).on('load' X (*1) X
$(function() X O

(*1) worked with RedMica v1.1.

from redmine-view-customize.

onozaty avatar onozaty commented on June 12, 2024

Thank you for the information.

I don't understand why the window load doesn't work well in Firefox.
Is there some kind of error?

Either way, we are thinking of including this feature.

from redmine-view-customize.

iquiw avatar iquiw commented on June 12, 2024

I don't understand why the window load doesn't work well in Firefox.

It could be a bug of Firefox though I am not sure.

Is there some kind of error?

No error, $('.gantt_subjects_column.ui-resizable').length is 0 in the case.

Either way, we are thinking of including this feature.

Thanks!
I will try to add unit test and update README.
I am afraid I cannot update Chinese translation.

from redmine-view-customize.

onozaty avatar onozaty commented on June 12, 2024

Either way, we are thinking of including this feature.

Thanks!
I will try to add unit test and update README.
I am afraid I cannot update Chinese translation.

It is okay to have a pull request in the current state.
I'll take care of the rest.

Thanks.

from redmine-view-customize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.