Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

jQuery is not reusable. #8

Closed
p10tyr opened this issue Aug 3, 2012 · 2 comments
Closed

jQuery is not reusable. #8

p10tyr opened this issue Aug 3, 2012 · 2 comments

Comments

@p10tyr
Copy link

p10tyr commented Aug 3, 2012

I think that you need to create a core JavaScript file.

This is going to take some remodelling to allow re usability for buttons like.

$('a.newCustomer').live('click', function () {

to be used on any page.

For example when I click proposal. It is obvious its for new customer. So I quickly want to add him.

I do not want to go edit customer... then proposal

This file should be loaded in Shared

any specific jQuery that only applies to ONE page should be loaded on that view - like UI effects, graphs or something.

@iloire iloire closed this as completed Aug 4, 2012
@iloire
Copy link
Owner

iloire commented Aug 4, 2012

Hi there!

Yes, I know, there are always lots of ways to improve things, and sometimes a few time to do it...
Feel free to send a pull request with those changes and I will merge :)

Thanks,

iván

@p10tyr
Copy link
Author

p10tyr commented Aug 9, 2012

HI,

Yes I would like to make some changes. I am not all that sure how to do it
though?

I have added support to attach files to an invoice - stores file in
database as blob in sql 2008.

I have been working with some of the javascript and there is allot of un
necessary script

for example

$('a.newFileUplaod').live('click', function () {
clearErrors();

          var id = $(this).attr("idInvoice");
          var url = '@Url.Content("~/DataStorage/UploadPartial")/' + id;

          getRequest(url);

          return false;
      });

can simply be

$('a.newFileUplaod').live('click', function () {
clearErrors();

          getRequest(getRequest($(this).attr('href')););

          return false;
      });

Because it is already have an href generated from MCV- also remove the
invoiceID property- that is bad taging any way. you should use
data-invoiceID then you can use jquery.data("invoiceID") - it is
in guidelines with HTML5

Besides- Using A href and the returning false is very bad code practice.

I will be working on this form time to time because I will use it for my
own personal needs. I like the desing and I am happy it is in MVC3 so its
easy to code.

Please let me know how I can update the code. Do i need to install
something and then downlaod the source control and update it back somehow-
like team explorer or source safe?

On 4 August 2012 01:35, Iván Loire <
reply@reply.github.com

wrote:

Hi there!

Yes, I know, there are always lots of ways to improve things, and
sometimes a few time to do it...
Feel free to send a pull request with those changes and I will merge :)

Thanks,

iván


Reply to this email directly or view it on GitHub:

#8 (comment)

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

No branches or pull requests

2 participants